• Resolved Hazel Z.

    (@cadencehart)


    Hi! I am using the Genesis Framework and I am trying to alphabetize posts in Category Pages. My code worked well if the posts are classified only in one (1) category but once I try to classify one post into 2 or more categories, the code no longer works.

    Here’s the code in my category.php template:

    <?php
    
    remove_action('genesis_loop', 'genesis_do_loop');
    add_action('genesis_loop', 'category_custom_loop');
    function category_custom_loop() {
    
        global $paged;
    	$cat = get_the_category();
    	$cat = $cat[0];
        $args = array('category__in' => $cat->cat_ID, 'paged' => $paged, 'orderby' => 'title', 'order' => ASC);
        $query_args = wp_parse_args($args);
        genesis_custom_loop( $query_args );
    
    }
    
    genesis();

    Appreciate your help. Thanks.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Alphabetizing Posts in Category Pages – Multiple Categories’ is closed to new replies.