Created
February 13, 2019 22:31
-
-
Save moxdev/7391584b216ec9c1b4724d82a48ab1e8 to your computer and use it in GitHub Desktop.
Display Taxonomy Posts in Ascending Alphabetical Order By Title #wp
This file contains hidden or 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
add_action( 'pre_get_posts', 'quantum_custom_property_locations_query_order' ); | |
/** | |
* Display Taxonomy Property Locations Page in Ascending Alphabetical Order By Title | |
* | |
* @link https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts | |
* @param object $query pre_get_posts WP_Query. | |
* @return void | |
*/ | |
function quantum_custom_property_locations_query_order( $query ) { | |
if ( $query->is_tax( 'property_locations' ) && $query->is_main_query() ) { | |
$query->set( 'orderby', 'title' ); | |
$query->set( 'order', 'ASC' ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment