Conditional two level dropdown filter for custom post type

Like I said in the comment, this can be solved by using two dropdowns. Additionally I already hinted you to an answer of mine doing this for a simple, one level, non conditional category selection. Category dropdowns can easily constructed with wordpress by making use of wp_dropdown_categories. To make it work as actual selection handed … Read more

Display all authors and their only one latest post

In @Sagive SEO answer get_users_of_blog() is a depricated function. What is below code do get all authors display name and id in $authorsList Loop threw each author id and use WP_Query to get latest post of each author <?php $authors=get_users(); $i=0; //get all users list foreach($authors as $author){ $authorList[$i][‘id’]=$author->data->ID; $authorList[$i][‘name’]=$author->data->display_name; $i++; } ?> <ul> <?php … Read more

WP_Query on custom post type not displaying, multiple loops & get_template_part

I think you forgot to check if $the_query have posts. <?php $args = array( ‘post_type’ => ‘testimonials’, ‘posts_per_page’ => 1, ‘orderby’ => ‘rand’ ); $the_query = new WP_Query( $args ); ?> <?php if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?> <div class=”testimonial push_2 grid_10 clearfix”> <blockquote>&ldquo;<?php the_field( ‘testimonial’ ); ?>&rdquo;</blockquote> <cite>&mdash;<?php … Read more

Custom Loop, Match Category with Page

If this is going in a page.php (or similar) template, then using query_posts() is a bad idea and could have some pretty bad consequences. I also prefer WP_Query over get_posts() as it easily allows you to use template tags and it explicitly exists for running secondary loops on a page. <?php global $post; $my_query_args = … Read more