• I am sure there is a way to do it using WordPress, but I haven’t been able to make it work either b/c I am probably over-thinking it.

    I’ve created a category.php template to display my Posts based on whatever their category is but what am generally trying to do is the following.

    If (all categories)
    show titles of post for all categories
    if (only categoryA selected and showing)
    filter to show titles for categoryA only
    if (only categoryB selected and showing)
    filter to show titles for categoryB only
    and so on…

    ====================
    Currently I have something like this, so I am looking for a better and more efficient way to do it.

    <?php if ( is_category('20') ) {
    	echo '<h1>';
    	printf( __( 'This is Category A', 'genesis' ), home_url() );
    	echo '</h1>';
    				<ul>
    					<?php wp_get_archives( 'type=alpha&limit=20' ); ?>
    				</ul>
    }
    ?>
    <?php if ( is_category('25') ) {
    	echo '<h1>';
    	printf( __( 'This is Category B', 'genesis' ), home_url() );
    	echo '</h1>';
    				<ul>
    					<?php wp_get_archives( 'type=alpha&limit=20' ); ?>
    				</ul>
    }
    ?>

    ====================
    This doesn’t seem very efficient, especially if you have 5 or more categories.
    I know if I do wp_get_archives() I can see all posts but I am not sure the best way to filter based on Category; but I don’t think there is a parameter to filter what I am trying to do so it’s just messy right now

    Any suggestions?

  • The topic ‘Filter Different Categories based on their ID’ is closed to new replies.