WordPress.org

Ready to get started?Download WordPress

Forums

Custom Category Template (3 posts)

  1. depiction
    Member
    Posted 6 years ago #

    I am trying to display posts by groups with each group/category having it's own header image and template. In my index.php file for my master template, I have the following:

    <?php
    if (is_home())
    {
    	include (TEMPLATEPATH . "<?php echo get_settings('home'); ?>/wp-content/themes/simpla/postlisting_home.php");
    }
    else if (is_category('3')) {
        include (TEMPLATEPATH . "<?php echo get_settings('home'); ?>/wp-content/themes/simpla/postlisting_news.php");
    }
    else if (is_category('4')) {
        include (TEMPLATEPATH . "<?php echo get_settings('home'); ?>/wp-content/themes/simpla/postlisting_media.php");
    }
    else {
        include (TEMPLATEPATH . "<?php echo get_settings('home'); ?>/wp-content/themes/simpla/postlisting_misc.php");
    }
    ?>

    Basically I am trying to get it so that if it is home, it uses a specfic template. If the page has posts for category 3, use the specified template, etc. However the above codes displays nothing. (All four template files exist and are correct.) I don't receive any error message at all.

  2. BPartch
    Member
    Posted 6 years ago #

    Hello

    You can create a file named home.php for the front page, then for each category you can use a specified template file: http://codex.wordpress.org/Category_Templates

    Hope it helps. :)

  3. krushinfo
    Member
    Posted 5 years ago #

    Specific template files for each category works great but is there anyway for the posts in that category to use that same specific template file?

Topic Closed

This topic has been closed to new replies.

About this Topic