• mithrustt

    (@mithrustt)


    For some reason, I thought I remembered seeing a little section when making a post to select what template to use for the post. Am I just remembering incorrectly, cause I can’t seem to find it. I know that if I want, I can add some PHP into my single post template so that if the post is a certain category, it will use a different template instead, but I was just wondering if there was the option to do it the first way.

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • MichaelH

    (@michaelh)

    Pages allow for the designation of a Page Template.

    For posts, you’ll want to review Template Hierarchy and Category Templates.

    Thread Starter mithrustt

    (@mithrustt)

    After reading those pages, it kind of seems (to me) that the category templates are more for archives, like, showing multiple posts of a certain category in a certain way. I just want to have an alternative to the single post template. If I were to make a new template, exactly the same as my single post template (for the sake of arguement) but just changed the background colour to a red and called the tempalte category-6.php, would it load for the single posts that are in that category or only for the archived posts in that category?

    I want to make it so this specific category uses the category-6.php for single posts, but not for the archives. Is this possible? As well, how do I find the category ID in WP 2.5? I have it so there are pretty permalinks, but I can’t seem to find where the cat ID is.

    Thread Starter mithrustt

    (@mithrustt)

    Alright, so I tried to just edit my singlepost.php instead so that if it was a post in a certain category, it shows up as such, and if it was another category, it shows up a different way, and every other category shows up as such. But it doesn’t do what I have set up as a test.

    http://think-theory.com/test-review/

    Instead of showing the text ‘this is a test review’ or showing the addthis image and links beside that, it should say ‘This is some generic text to describe all other category pages, I could be left blank.’ This is the code I’ve used, which I got from the codex:

    <?php if (is_category('reviews')) { ?>
    <p>This is some generic text to describe all other category pages,
    I could be left blank</p>
    <?php } elseif (is_category('special reviews')) { ?>
    <p>This is the text to describe category B</p>
    <?php } else { ?>
    
    <div id="post">
    
                	<?php the_content('<p>Continue reading this post</p>'); ?>
    
    <div id="post_footer">
    	<div class="post_meta">
    						<!-- AddThis Button BEGIN -->
    <a href="http://www.addthis.com/bookmark.php" onclick="window.open('http://www.addthis.com/bookmark.php?wt=nw&pub=Saving Progress&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title), 'addthis', 'scrollbars=yes,menubar=no,width=620,height=520,resizable=yes,toolbar=no,location=no,status=no,screenX=200,screenY=100,left=200,top=100'); return false;" title="Bookmark and Share" target="_blank"><img src="http://s9.addthis.com/button1-addthis.gif" class='addthis' width="125" height="16" border="0" alt="Bookmark and Share" /></a>
    <!-- AddThis Button END --> <span class="dot">&sdot;</span> <?php if(function_exists('wp_email')) { ?> <?php email_link(); ?> <span class="dot">&sdot;</span> <?php } ?> <?php if(function_exists('wp_print')) { ?> <?php print_link(); ?><?php } ?>
    					</div>
    </div>
    </div>
    
    <?php } ?>

    Any ideas on what I’ve done wrong?

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Post Template Selection’ is closed to new replies.