Support » Fixing WordPress » Loop Trouble

  • I have two loops going on on my site one is in the header and is set to get 1 post from the featured category and another that is set to get all post I don’t care if it has duplicates. Now this seems to work but when I get on to the single page I can’t comment and all the posts pages now have the featured post on them. I hope I did a good job of explaining here is the site so you can see better

    and here is the code.


    <?php query_posts(‘category_name=featured&showposts=1’); ?>
    <?php while (have_posts()) : the_post(); ?>
    ” rel=”bookmark” title=”Permanent Link to <?php the_title_attribute(); ?>”><div id=”featured-image”><?php the_meta(); ?>
    <div id=”featured-title”> Featured: <?php the_title() ?></div>

    <?php endwhile;?>


    <?php query_posts(‘cat=all’); ?>

    <?php if (have_posts()) : ?>

    <?php while (have_posts()) : the_post(); ?>

    <div class=”post” id=”post-<?php the_ID(); ?>”>
    <h2 class=”post-title”>” rel=”bookmark” title=”Permanent Link to <?php the_title_attribute(); ?>”><?php the_title(); ?></h2>
    <div id=”entry”>
    <?php the_content(‘Read the rest of this entry »’); ?>
    <div id=”meta-data”>
    Posted by <?php the_author() ?> at <?php the_time(‘F jS, Y’) ?> in <?php the_category(‘, ‘) ?> with the following tags : <?php the_tags(‘Tags: ‘, ‘, ‘, ‘
    ‘); ?>

    <?php endwhile; ?>

    <div class=”next-previous”>
    <div><?php next_posts_link(‘« Older Entries’) ?></div>
    <div><?php previous_posts_link(‘Newer Entries »’) ?></div>

    <?php else : ?>

    <h2>Not Found</h2>
    <p>Sorry, but you are looking for something that isn’t here.</p>
    <?php include (TEMPLATEPATH . “/searchform.php”); ?>

    <?php endif; ?>


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

    <div class=”navigation”>
    <div><?php previous_post_link(‘« %link’) ?></div>
    <div><?php next_post_link(‘%link »’) ?></div>

    <div class=”post” id=”post-<?php the_ID(); ?>”>
    <h2>” rel=”bookmark” title=”Permanent Link: <?php the_title_attribute(); ?>”><?php the_title(); ?></h2>

    <?php the_content(‘<p class=”serif”>Read the rest of this entry »</p>’); ?>

    <?php wp_link_pages(array(‘before’ => ‘<p>Pages: ‘, ‘after’ => ‘</p>’, ‘next_or_number’ => ‘number’)); ?>
    <?php the_tags( ‘<p>Tags: ‘, ‘, ‘, ‘</p>’); ?>
    <p class=”postmetadata alt”>
    This entry was posted
    <?php /* This is commented, because it requires a little adjusting sometimes.
    You’ll need to download this plugin, and follow the instructions: */
    /* $entry_datetime = abs(strtotime($post->post_date) – (60*120)); echo time_since($entry_datetime); echo ‘ ago’; */ ?>
    on <?php the_time(‘l, F jS, Y’) ?> at <?php the_time() ?>
    and is filed under <?php the_category(‘, ‘) ?>.
    You can follow any responses to this entry through the <?php comments_rss_link(‘RSS 2.0’); ?> feed.

    <?php if ((‘open’ == $post-> comment_status) && (‘open’ == $post->ping_status)) {
    // Both Comments and Pings are open ?>
    You can leave a response, or ” rel=”trackback”>trackback from your own site.

    <?php } elseif (!(‘open’ == $post-> comment_status) && (‘open’ == $post->ping_status)) {
    // Only Pings are Open ?>
    Responses are currently closed, but you can ” rel=”trackback”>trackback from your own site.

    <?php } elseif ((‘open’ == $post-> comment_status) && !(‘open’ == $post->ping_status)) {
    // Comments are open, Pings are not ?>
    You can skip to the end and leave a response. Pinging is currently not allowed.

    <?php } elseif (!(‘open’ == $post-> comment_status) && !(‘open’ == $post->ping_status)) {
    // Neither Comments, nor Pings are open ?>
    Both comments and pings are currently closed.

    <?php } edit_post_link(‘Edit this entry.’,”,”); ?>

    <?php comments_template(); ?>

    <?php endwhile; else: ?>

    <p>Sorry, no posts matched your criteria.</p>

    <?php endif; ?>

    any and all help is much appreciated

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Loop Trouble’ is closed to new replies.