• jinsan

    (@jinsan)


    Have you (yes, you in the back stop hiding!) been able to achieve this? I’ve read A LOT of information, at times it’s pretty confusing, but I think I know where I am headed with it and how it will (and can) work. But, I have yet to see any working example for all the comments of “it’s workable”.

    I’ve got a far as creating one template/style/theme which I have modified five times for give subtly distinct looks. I also need to understand a couple of things:

    With the side bar, is it possible to have a plugin that create recent reviews list based on the category? Or in fact customise several elements of the side bar to be unique to that category.

    Also how will the header amd sidebar know which files to call? I mean I have style 2 for cat 2, and what I want is for the header to call a different header image, and for the sidebar to call the customised sidebar content (if it’s possible). So do I create seperate headers (header2, header2) and side.php files to match the category, so that the category calls header2.php and sidebar.php instead?

    Am I on the right track? This is what I have copied from teh index file, and have made 6 copies for the six categories.

    <?php get_header(); ?>
    <?php get_sidebar(); ?>
    <div id="content">

    <?php
    if ($posts) {
    foreach($posts as $post) { start_wp();
    ?>
    <br />
    <div class="post">
    <a class="title" href="<?php the_permalink() ?>" style="text-decoration:none;" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></a>
    <div class="cite"><?php the_time("l F dS Y") ?>, <?php the_time() ?> <?php edit_post_link(); ?><br />
    <?php _e("Filed under:"); ?> <?php the_category(',') ?></div>

    <?php the_content(); ?>

    <div class="commentPos"><?php wp_link_pages(); ?><?php comments_popup_link(__('0 Comments'), __('1 Comment'), __('% Comments')); ?></div>
    <br />

    <div class="sep"></div>

    <!--
    <?php trackback_rdf(); ?>
    -->

    <?php comments_template(); // Get wp-comments.php template ?>
    </div>
    <?php } // closes printing entries with excluded cats ?>

    <?php } else { ?>
    <?php _e('Sorry, no posts matched your criteria.'); ?>
    <?php } ?>

    <div class="right"><?php posts_nav_link('','','previous &raquo;') ?></div>
    <div class="left"><?php posts_nav_link('','&laquo; newer ','') ?></div>

    <br /><br />

    </div>

    <?php get_footer(); ?>

    I think I’m on the right track but don’t know where to go next

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi Jinsan,

    I think I’ve been down this path before, and I struggled to get the answers. Luckily for you I did document a part of it on my blog at http://www.devineprojects.org/blog/index.php/archives/2005/03/wordpress-category-styles/

    The file you listed above is index.php (?) but the one you need is category.php. Copy the file and rename it to category-1.php (where 1 is your category id in the admin panel). Now that file will be used instead of index.php when that category is viewed.

    To change what’s shown on the page you can add/remove the relevant parts in the category-x.php file, however it will still obey the same CSS as the rest of your blog. To change that styling copy and rename the style.css to category-1.css, maybe those names aren’t quite right but you get the idea.
    You then need to find(in category-x.php)
    <style type=”text/css” media=”screen”>
    @import url<?php bloginfo(‘stylesheet_url’); ?> );
    </style>
    and change that to
    <style type=”text/css” media=”screen”>
    @import url(<?php bloginfo(‘stylesheet_directory’); ?>/category-1.css );
    </style>

    This guy did it and has the code, too:
    http://wordpress.org/support/topic/30653

    Switching CSS between templates is a growing interest on a number of platforms :). Jinsam have you considered using the body id? That way you can put all your CSS in one file which saves on proliferation. Two – you then only need to add the bits which change. So if your category has an id of category the CSS syntax is # category #masthead {new bg image etc}for example. But what do I know.?

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

The topic ‘Successful in using diff tempalte for cat?’ is closed to new replies.