WordPress.org

Ready to get started?Download WordPress

Forums

Post from a different catagory at the top of the catagory page (5 posts)

  1. j0d
    Member
    Posted 9 years ago #

    as an example( http://theolds.j0d.net) the top post is in the catagory headline,

    What i wanted to know if there is a way of ,on the catagories page, put the post that is in both under the catagory page it is on and that it is either a headline or subheadline at the top?

  2. Kafkaesqui

    Posted 9 years ago #

    Um, what? You want the "top post" to appear at the top of every category page? Or are you asking to take the posts appearing on the main page under their respective "headlines" to *stick* at the top of each category page?

    I'm not quite understanding your request, so provide some more detail.

  3. j0d
    Member
    Posted 9 years ago #

    sorry i apologise for not being clear,

    I would like, the first post on each catagory page, to be the post that is both from under that catagory AND under the headline or subheadline catagory, As an example

    On the "entertainment" catagory page the article placed at the top, will be under the catagory "entertainment" and "subheadline"or "headline.

    Hopefully that explains it better, Any help would be appreciated thanks.

  4. opaz59
    Member
    Posted 8 years ago #

    I know what you mean! cos I want to do that too. Did you find a way?

  5. nearlythere
    Member
    Posted 8 years ago #

    judicious use of a category templates and the query_posts() will help you reach your goal. ah... but you also need to use multiple loops so you can continue to display the normal category:

    http://codex.wordpress.org/Category_Templates
    http://codex.wordpress.org/Template_Tags/query_posts
    http://codex.wordpress.org/The_Loop#Multiple_Loops

    create a category.php template, which will be used to display each of your categories. whereever you want to display your headline post place this:

    <?php $temp_query = $wp_query; ?>
    <?php query_posts('category_name=headline&showposts=1'); ?>

    <!-- insert your loop here to display the entry like this simple one below: -->

    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a> </h2>
    <?php the_content('Read the rest of this entry &raquo;'); ?>
    <?php endwhile; else : endif; ?>

    // now back to our regularly scheduled programming
    <?php $wp_query = $temp_query; ?>

    and you can have the rest be the normal loop you were going to use anyway, and it should all display nicely.

Topic Closed

This topic has been closed to new replies.

About this Topic