• I have a book blog and I’d like to set up a category page such as “Reviews Sorted by Author” or “Reviews Sorted by Genre” where each page has an alphabetical list of the subcategories for that category. Am I making sense? How can I go about doing this?

Viewing 1 replies (of 1 total)
  • I use a custom function which looks a bit like this:

    <?php
    function loop(  ) {
    	global $post;
    
    	$post_class = 'post'; /* Class for all posts. */
    	$post_class .= ( is_sticky() ) ? ' sticky' : ''; /* Don't forget about stickiness. */
    	$post_class .= ( in_category( 4 ) ) ? ' stinky-cheeses' : '';
    	$post_class .= ( in_category( 17 ) ) ? ' blue-monkeys' : '';
    	$post_class .= ( in_category( 66 ) ) ? ' taco-freakout' : '';
    
    	print "\n\t" . '<div class="'. $post_class .'" id="post-' . get_the_ID() . '">';
    		/* Do your normal loop stuff here */
    	print "\n\t" . '</div><!-- end post -->';
    }
    ?>

    Call this function inside the loop in category.php

Viewing 1 replies (of 1 total)
  • The topic ‘A category page with an alphabetical list of subcategories?’ is closed to new replies.