Stuck in the query loop

<div class=”pr_grid_cell clearfix”> <?php //for each category, show posts $categories=get_categories(); foreach($categories as $cat) { $args=array( ‘post_type’ => ‘products’, ‘showposts’ => -1, ‘category__in’ => array($cat->term_id) ); $posts = new wp_query($args); // This is the best way to if ($posts->have_posts()) while ($posts->have_posts()) { //condional if/while 2-in-1. If you dont check have_posts, you’ll get an ugly error when … Read more

Trying to store submenu items to render out after main menu

Yesterday I had the same kind of problem and I decided to ditch the walker alltogether and use the wp_get_nav_menu_object and wp_get_nav_menu_items functions instead. If you var_dump($menu_items) you can see which properties are available. Here’s a snippet of my code that builds the menu named ‘main’ for my twitter bootstrap menu: $menu_name=”main”; // name of … Read more

Styling my own password protected page, how to deal with wrong password?

This worked for me adding this code in functions.php: add_filter( ‘the_password_form’, ‘wpse_71284_custom_post_password_msg’ ); /** Add a message to the password form. @wp-hook the_password_form @param string $form @return string */ function wpse_71284_custom_post_password_msg( $form ) { // No cookie, the user has not sent anything until now. if ( ! isset ( $COOKIE[ ‘wp-postpass‘ . COOKIEHASH ] … Read more