Performance concerns: index.php vs taxonomy-$taxonomy.php

TL;DR Template: Performance not so much, semantics however, use hierarchy! TL;DR Query String: Use provided hooks, never edit directly. The Template File Apart from performance, first look at semantics. If you direct your browser to a taxonomy archive, WordPress will look for the following files (straight from the Codex): taxonomy-{taxonomy}-{term}.php – If the taxonomy were … Read more

Tax_Query using WP_Query not working

You aren’t looping through the results. Here is your code: $m = new WP_Query( $myquery ); if ( $m->have_posts() ) : $m->the_post();?> <ul><li <?php post_class();?>><a href=”https://wordpress.stackexchange.com/questions/83409/<?php the_permalink(); ?>”><?php the_title(); ?></a></li></ul> <?php endif; wp_reset_postdata(); ?> There is no Loop. You just check for the existence of posts, echo some information about the first one and quit. … Read more

Reordering content using a meta value

Check WP_Query Order by Parameters $args = array( ‘post_type’ => ‘my_custom_post_type’, ‘meta_key’ => ‘age’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘ASC’, ‘meta_query’ => array( array( ‘key’ => ‘age’, ‘value’ => array(3, 4), ‘compare’ => ‘IN’, ) ) ); $query = new WP_Query($args);

Single post – display list of all posts + specific post

When the single post template is loaded, WordPress has already queried the database for that post. When you call query_posts(‘post_type=post&posts_per_page=1′);, and then run the loop, this simply loads and outputs a single post, which by default will be the latest post. It also has the side-effect of overwriting the original main query. You don’t need … Read more

Trouble Making WP_Query paged

Pagination in URLs only works for the “main” query. What you’ve created is a secondary query, so WordPress doesn’t “know” about it in such a way that the application would be able to create pagination. If you use a secondary query (like your example) it’s up to you to do the pagination stuff manually. Rather … Read more

Query custom posts from custom taxonomy

You should access global variables in php using global keyword.It makes variable( or object, array) visible inside current function we are dealing with. In function wms_output_home_slides you are using $post global variable directly instead access it using global keyword as following. function wms_output_home_slides($cat) { // $cat=”homeslide” global $post; // You Code Goes here } Find … Read more