Pagination Not Working When Modifying Loop Based on Post Category

different approach: global $wp_query; $args = array_merge( $wp_query->query, array( ‘category__not_in’ => array(4,7) ) ); query_posts( $args ); get_template_part( ‘loop’, ‘index’ ); if this approach should not work, please check if one or more of the plugins is interfering – deactivate all plugins; if the exclusion of categories works then, re-activate one plugin at a time … Read more

Best Way to Display Posts by Tag (not category)

Query first set of posts (probably with get_posts(), unless you feel up to using WP_Query directly). Loop through it, display, save their IDs in some variable. Loop through them again, display thumbnails. Query second set of posts, excluding IDs saved earlier via post__not_in. Loop through it and display.

Loop Offset for tag based “Related Posts”

doing 3 separate queries is unnecessary and inefficient, do one query for all 12 posts and output your container markup every fourth post. $args = array( ‘tag__in’ => $tag_ids, ‘post__not_in’ => array($post->ID), ‘posts_per_page’=> 12 ); $my_query = new WP_Query( $args ); if( $my_query->have_posts() ): ?> <div class=”container”> <?php while ( $my_query->have_posts() ) : $my_query->the_post(); the_title(); … Read more

difference between querying database and using the loop

There is no absolute better/worse/best/worst implementation. The correct implementation depends on what you’re trying to accomplish. For a great explanation, I direct you to this post by Digging Into WordPress, which explains the 4 basic means of interacting with the WordPress Loop: Default Loop So what makes it “default”? Mostly because it uses the default … Read more

the_content() returning null in one category only, even though there is content

Is there any way to output the raw, unfiltered post HTML to find out whether this is a rogue filter deleting all the content in that specific category for some weird reason? Yes there is, you can use $post->post_content. Try adding something like: echo ‘<pre>’.$post->post_content.'</pre>’; just before the_content() call in your template file. What else … Read more

WordPress Query Posts From Category Post on Static Page

Weird Problem!, try the following: Make sure that the targeted categories are not empty. If you are using custom post type,include it in the query ‘post_type’=>’advertisement’ for example. If the targeted categories are special taxonomies,make sure to include it in the query : ‘term’=>’cars’ along with child ‘cars’=>’toyota’. in this example and just to make … Read more