Created
March 5, 2014 14:27
-
-
Save billerickson/9368169 to your computer and use it in GitHub Desktop.
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
<?php | |
/** | |
* Add 'page-attributes' to Portfolio Post Type | |
* | |
* @param array $args, arguments passed to register_post_type | |
* @return array $args | |
*/ | |
function be_portfolio_post_type_args( $args ) { | |
$args['supports'][] = 'page-attributes'; | |
return $args; | |
} | |
add_filter( 'portfolioposttype_args', 'be_portfolio_post_type_args' ); | |
/** | |
* Sort projects by menu order | |
* | |
*/ | |
function be_portfolio_query( $query ) { | |
if( $query->is_main_query() && !is_admin() && ( is_post_type_archive( 'portfolio' ) || is_tax( array( 'portfolio_category', 'portfolio_tag' ) ) ) ) { | |
$query->set( 'orderby', 'menu_order' ); | |
$query->set( 'order', 'ASC' ); | |
} | |
} | |
add_action( 'pre_get_posts', 'be_portfolio_query' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment