WordPress.org

Ready to get started?Download WordPress

Forums

Custom category pages (4 posts)

  1. aylia
    Member
    Posted 8 years ago #

    Hi,

    I want to create custom category front pages that have the feeling of an index with only a couple of highlighted posts, with then a link to the rest of that categories archives.

    I've got 2 ideas of how I could do this:
    1) set up a page for each category, leaving the archive page as it is. I think this would would, but wouldn't create a url structure
    2) use pagination to make page 1 customised and page 2 onward as normal archives (ie. just a list of post titles) I'm not sure this work..

    Any ideas?

    Thanks for your help.

  2. moshu
    Member
    Posted 8 years ago #

    I don't really see hoe your solutions would work... but you can always take a look at the Category Templates ;)
    http://codex.wordpress.org/Category_Templates

  3. deko
    Member
    Posted 8 years ago #

    I've done this. I've written a script that dynamically selects a category-specific header image as well.

    If you're comfortable with php, it's a snap.

    In any case, use the archive template with a loop that looks something like this:

    <?php get_header(); ?>
    <div id="content" class="narrowcolumn">
    <?php if (have_posts()) : ?>
    <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
    <?php if (is_category()) { ?><h2 class="red"><?php
    if (!in_category(1)) { echo single_cat_title(); } }?></h2>
    <div class="navigation">
    <div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div>
    <div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div>
    </div>
    <?php while (have_posts()) : the_post(); ?>
    <div class="post">
    <h2 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
    <div class="entry">
    <?php the_content() ?>
    </div>
    <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?>
    <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
    </div>
    <?php endwhile; ?>

  4. aylia
    Member
    Posted 8 years ago #

    thanks I will give that a go :)

    also, to Moshu, I have looked at that page - its the sticky text section which made me wonder whether I could use the if ( $paged < 2 ) function. I just wasn't sure whether that would work!

Topic Closed

This topic has been closed to new replies.

About this Topic