Tag Info

Hot answers tagged

3

Here's a straight up simple solution. Requires you to have the most recent version of WordPress though. (or at least 4.1) Using nested taxonomy query. Taking what you have, and just adding to it a bit. $args = array( 'post-type' => 'episode', 'post-status' => 'publish', 'posts_per_page' => 4, 'tax_query' => array( ...


2

The main query is generated before the template is loaded, the results of the main query are how WordPress knows what template to load. If you want to alter query parameters of the main query to change things like orderby, you should add a function hooked to pre_get_posts. The argument passed to the function contains the query parameters of each query, so ...


1

You cannot mix array syntax and string syntax in the same argument. If you start with array syntax, you should stick with that, the same applies if you start with string syntax, then you should stick with string syntax. Because you are using post__not_in which is an array, you should stick with array syntax <?php $query = new WP_Query( array( ...


1

It is already solved here. http://stackoverflow.com/questions/16889207/how-to-order-wordpress-posts-by-a-custom-field-date Just make sure you use 'meta_value_num' for 'orderby' and convert your date values from custom meta's to 'yyyymmdd'.


1

I have achieved this in the past by using the following method. $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( 'post_type' => 'gtre', 'posts_per_page' => 6, 'paged' => $paged, 'meta_key' => 'price', 'orderby' => 'meta_value_num', 'order' => ...


1

You may be able to use a WP_Query on nav_menu_item since it is its own post type. I've never done this but maybe it would work like you need it to, worth a shot. There are three other possibilities: Option 1 - Get Your Nav Menu Items There's a functions called wp_get_nav_menu_items() which will return you an array of your menu items that you can then loop ...



Only top voted, non community-wiki answers of a minimum length are eligible