Skip to content

Instantly share code, notes, and snippets.

@JiveDig
Last active December 18, 2015 19:39
Show Gist options
  • Save JiveDig/5834083 to your computer and use it in GitHub Desktop.
Save JiveDig/5834083 to your computer and use it in GitHub Desktop.
Use WP_Query To Alter The Posts Per Page Of A Custom Taxonomy Term Archive Of A Custom Post Type. When using Post Types Order plugin ( ) add: 'orderby' => 'menu_order', to the $args
<?php
//* Replace the standard loop with our custom loop
//* props to David Wang, he is the man!
// @author David Wang
// @link http://genesissnippets.com/genesis-custom-loop/
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'child_do_custom_loop' );
function child_do_custom_loop() {
global $paged; // current paginated page
global $query_args; // grab the current wp_query() args
$args = array(
'paged' => $paged, // respect pagination
'post_type' => 'portfolio',
'taxonomy' => 'portfolio_cat',
'term' => 'media-analyst',
'posts_per_page' => '18',
'orderby ' => 'menu_order', // for use with http://wordpress.org/plugins/post-types-order/
);
genesis_custom_loop( wp_parse_args($query_args, $args) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment