• I have been trying to find a way to show one category differently then others on the front page. As of yet I have not had any luck in finding some thing that works. The entire template for this category will be designed differently, I just have no clue on how to achieve this.

    Any help or tips would be greatly appreciated.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter btmedia

    (@btmedia)

    I’ve tried that, can’t find any thing specifically saying the home page. Can you please point out what I may be missing?

    Thank you very much for any help.

    Do want the category display to be different? Or the display of posts in this category to be different on your front page? They’re two very different things…

    Thread Starter btmedia

    (@btmedia)

    I am only referring to the front page. I would like all posts in one category to display differently then the others.

    codex.wordpress.org/Category_Templates

    wrote:
    So, if you want to make the Category whose ID number is 6 look different from what it is currently (and different from other Category pages), you would want to create a category-6.php file.
    ————-
    So, what should I write in this file?

    codex.wordpress.org/Category_Templates

    wrote:
    If you want to make all Category pages look different from other archive pages (such as date and author archives), then you would want to create or modify the category.php file.
    ————–
    How to modify ?

    you can use the if argument:

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

    (http://codex.wordpress.org/Function_Reference/in_category)

    I’ve done it for a site and used this:

    <?php if ( in_category( array( 6,7,8 ) ) ) : ?>
    <div id=”post-<?php the_ID(); ?>” <?php post_class(); ?>>
    <div class=”projectlink”>

    <?php if (in_category (6)): ?> Show this text in category 6
    <?php elseif (in_category (7)): ?> Show this text in category 7
    <?php elseif (in_category (8)): ?> Show this text in category 8
    <?php endif; ?>

    <h2 class=”entry-title”><?php the_title(); ?></h2>
    <?php the_content( ); ?>
    <?php endif; ?>

    </div><!– projectlink –>

    </div><!– post –>

    Or maybe this is what you want; query_posts

    For example if you want to show the category number 4: query_posts(‘cat=4’);
    Put this before starting the loop. End the loop and run the loop again for the rest of your posts.

    (http://codex.wordpress.org/Function_Reference/query_posts)

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Home Page – Different Category, Different Template’ is closed to new replies.