WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] query_posts, WP_query...getting confused (3 posts)

  1. bonanza9
    Member
    Posted 5 years ago #

    hi,

    i'd like to create a homepage beginning with a short 'home blurb' post (id=188) at the top (which has been categorised in 'home blurb' - id=19), followed by all other posts.

    i've used <?php query_posts("cat=-19"); ?> before the loop to filter out the the home blurb post, but can't figure out how to place the blurb above all the other posts.

    i've been reading the docs for query_posts and WP_query, but i'm still unsure about how to get this working, or what to search for on the forums.

    any help on this would be greatly appreciated.

    cheers,

    b9

  2. MichaelH
    Member
    Posted 5 years ago #

    Could just use a plugin such as WP-Sticky for that.

    Note, with Version 2.7 (November 2008) you will be able to say "Stick this post to the front page" for one or more posts.

  3. bonanza9
    Member
    Posted 5 years ago #

    thanks for your response.
    i decided to do this instead:

    <?php $home_blurb = new WP_Query('p=188'); ?>
    <?php while ($home_blurb->have_posts()) : $home_blurb->the_post(); ?>
    <?php $do_not_duplicate = $post->ID; ?>
    <div class="post" id="post-<?php the_ID(); ?>">
    <h1><?php the_title(); ?></h1>
    <div class="entry">
    <?php the_content(); ?>
    </div>

    that i found on:

    http://www.jek2k.com/wp/index.php/2006/10/30/wordpress-displaying-content-outside-the-loop/

    thanks again.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.