-
-
Save richtabor/4c320afe37e2e9ad8b8c302675faa832 to your computer and use it in GitHub Desktop.
Filter the portfolio category in York
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function york_filter_portfolio_category( $args ) { | |
if ( is_archive('post') OR is_category() OR is_tag() ) { | |
$post_type = 'post'; | |
} else { | |
$post_type = 'portfolio'; | |
} | |
// Pull pagination count setting from the Customizer. | |
$portfolio_posts_count = get_theme_mod( 'portfolio_posts_count', -1 ); | |
// Pull pagination from the reading settings. | |
$paged = 1; | |
if ( get_query_var('paged') ) $paged = get_query_var('paged'); | |
if ( get_query_var('page') ) $paged = get_query_var('page'); | |
return $args = array( | |
'post_type' => $post_type, | |
'order' => 'ASC', | |
'orderby' => 'menu_order', | |
'paged' => $paged++, | |
'posts_per_page' => $portfolio_posts_count, | |
'tax_query' => array( | |
array( | |
'taxonomy' => 'portfolio_category', | |
'field' => 'slug', | |
'terms' => apply_filters( 'ava_portfolio_category_filter', 'design' ), | |
), | |
), | |
); | |
} | |
add_filter( 'york_portfolio_args', 'york_filter_portfolio_category' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment