WordPress.org

Ready to get started?Download WordPress

Forums

Messing with the_Loop (3 posts)

  1. DanM
    Member
    Posted 8 years ago #

    Rightyo.
    I decided yesterday that I was going to get rid of my 'asides' plugin (that has served me well, I must add) and code my own solution. Using the codex, and this post by Phu Ly I set about coding. And I failed.

    The basic loop:
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    <?php endwhile; else: ?>
    <?php _e('Sorry, no posts matched your criteria.'); ?>
    <?php endif; ?>

    To this, I added:
    <?php query_posts('category_name=asides'); ?>

    <?php if (have_posts()) :
    while (have_posts()) : the_post(); ?>
    <?php the_title(); ?>
    <?php endwhile;?>
    <?php endif;?>

    That worked, but I didn't really want those posts at the bottom of each page. So I simply cut and pasted that code to the top. It didn't work, and I think I know why, but I don't know how to do it. In fact, I can't even describe what I think I need to do, heh!
    I'm going to keep messing around with this, and use an implementation of Matt's Asides until I've figured it out, but any assistance would be appreciated.

  2. Lorelle
    Member
    Posted 8 years ago #

    Have you checked this:

    http://codex.wordpress.org/The_Loop_in_Action

    There is a method to handling asides without a plugin in there, if I remember right.

  3. DanM
    Member
    Posted 8 years ago #

    I'm sorry, but I can't see what I'm looking for on there but I can't believe I missed that page when I was browsing through last night :)

Topic Closed

This topic has been closed to new replies.

About this Topic