Support » Themes and Templates » Displaying a specific post in category/archive template?

  • hobbahobba


    I have a category called “cars” (it’s ID # is 9). I want to have a category template page that shows BOTH a specific post (that sticks out on top of content as a “welcome post”) then it proceed with looped posts with “cars” category on them.

    So it looks something like this:

    Welcome Post (sticks out in front of page)
    cars post #9
    cars post #8
    cars post #1

    I can mod the php file so that the welcome post will be static. But since I’m doing a page for someone who is not php savvy and likes to change content in welcome post, I have to generate the welcome post off the admin.

    So I used

    // retrieve one post with an ID of 5

    And it pulls up the welcoming post but the following cars posts don’t show up. It seems like it kills the loop.

    Please help

Viewing 2 replies - 1 through 2 (of 2 total)
  • Eric Amundson


    Volunteer Moderator

    You could to do something like:

    <?php query_posts(‘pagename=carswelcome’); ?>
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <?php the_title(‘<h4>’, ‘</h4>’); ?>
    <?php the_content(); ?>
    <?php endwhile; ?>
    <?php endif; ?>

    I’d place it right above the loop in its own <div> maybe.



    Thanks, will try it.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Displaying a specific post in category/archive template?’ is closed to new replies.