• Resolved ArdorEdor

    (@ardoredor)


    I have a blog on my portfolio site that includes only one category. On the page for the blog there’s a sidebar where I list all of the posts sorted by their title. My problem is that I can’t figure out how to isolate and style a single page specifically for the blog. So for example, when you click on the title on the sidebar it takes you to a generic single.php page, the same one used for other single pages on the rest of the site.. How can I create a single page just for the blog. I tried calling a single-9.php to isolate the category number but it didn’t work. Any help would be appreciated.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Try the conditional tag in_category

    http://codex.ww.wp.xz.cn/Template_Tags/in_category

    Thread Starter ArdorEdor

    (@ardoredor)

    Cool thanks! Following off of the link you sent, I’m trying to “Test the current post outside the Loop” using this on my single.php page, but it doesn’t work:

    <?php if ( in_category(‘news’) ) {
    include ‘single-news.php’;
    } else {
    // Continue with normal Loop
    if ( have_posts() ) : while ( have_posts() ) : the_post();?>

    <?php the_content(); ?>

    Do I need to include this somewhere?:

    <?php in_category( $category, $_post ) ?>

    Thread Starter ArdorEdor

    (@ardoredor)

    This is what I put in the loop and it doesn’t work:

    <?php in_category( $category, $_post ) ?>

    <?php
    if ( in_category(‘News’) ) {
    include ‘single-cat-9.php’;
    } else {
    // Continue with normal Loop
    if ( have_posts() ) : while ( have_posts() ) : the_post();

    } ?>

    <?php the_content(); ?>

    <?php endwhile; ?>
    <?php endif; ?>

    Thread Starter ArdorEdor

    (@ardoredor)

    Figured it out using this widget.. Thanks!

    http://ww.wp.xz.cn/extend/plugins/custom-post-template/

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

The topic ‘Isolating a Single.php page’ is closed to new replies.