Change content off every sixth element

query_posts should only be used for the main loop. Instead, use a new instance of the WP_Query class: $my_query = new WP_Query( array( ‘post_type’ => ‘post’, ‘posts_per_page’ => 10, ‘order’ => ‘DESC’, ‘paged’=> $paged ) ); echo ‘<ul>’; while ( $my_query->have_posts() ) : $my_query->the_post(); if ( $my_query->current_post > 0 && ( $my_query->current_post + 1 ) … Read more

Disable (or limit) queries when certain content (or data) is not needed (or showed)

You can filter ‘posts_fields’, check if it is the main query and limit the queried fields to … whatever you need. See WP_Query::get_posts() in /wp-includes/query.php for details and side effects. For debugging the queries I recommend the plugin Debug Bar. If you add … define( ‘WP_DEBUG’, TRUE ); define( ‘SAVEQUERIES’, TRUE ); … to your … Read more

Display featured posts for a custom post type by taxonomy

If you don’t need a “tag”, I have seen “Featured” items be featured by some a post meta key. I always need a way to feature items, so yesterday I wrote a plugin that will add a metabox to any post type you’d like, with a simple checkbox. Also has columns and quickedit capabilities. https://github.com/helgatheviking/Featured-Item-Metabox … Read more