• Resolved aliceralph

    (@aliceralph)


    Hello

    My categories currently show up in columns but my client would like one category to be displayed differently.

    Currently the code is:

    <?php $category_description = category_description();
    		if ( ! empty( $category_description ) )
    		echo '<div class="archive-meta">' . $category_description . '</div>';
    
    		/* Run the loop for the category page to output the posts.
    		* If you want to overload this in a child theme then include a file
    		* called loop-category.php and that will be used instead.
    		*/
    
    		get_template_part( 'loop', 'columns' );?>

    Can I change this so that it will use a different template for one (potentially two) different categories?

    Many thanks

    Alice

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter aliceralph

    (@aliceralph)

    …looking at this closely now (*facepalm*) maybe the answer is in the code?! Can I use loop-music.php for the music category?

    category templates?
    http://codex.wordpress.org/Category_Templates

    you could make a category-music.php (start simply with a copy of category.php or archive.php) and use get_template_part( 'loop', 'music' ) within it; and create a loop-music.php with the special layout.


    alternatively, you could use conditional statements using for example is_category('music') to call different loop-music.php from within the existing category.php.

    Thread Starter aliceralph

    (@aliceralph)

    You are my hero!! This worked great, I created loop-music.php and it worked perfect. Thanks so much 😀

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Using different templates for different categories’ is closed to new replies.