Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Order WordPress archive posts by "Title" in "Ascending" order for one specific category.
<?php
//* Do NOT include the opening php tag
function b3m_before_loop () {
if( is_category( '1' ) ) {
global $query_string;
query_posts( wp_parse_args( $query_string, array( 'orderby' => 'title', 'order' => 'ASC' ) ) );
}
}
add_action( 'genesis_before_loop', 'b3m_before_loop' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.