2 edited body
source | link

Any ideas as to how the non-rewinding issue in this setu pcansetup can be fixed, or alternatively how the objective can be attained by other means?

Any ideas as to how the non-rewinding issue in this setu pcan be fixed, or alternatively how the objective can be attained by other means?

Any ideas as to how the non-rewinding issue in this setup can be fixed, or alternatively how the objective can be attained by other means?

1
source | link

Including post data in a sidebar occurring outside of and before the Loop

I'm having problems setting up a single WordPress template page to display post data outside of the Loop. The page has a left sidebar in which I want to display post meta data, tags and navigation links to previous and next posts, followed by a main column with the post title and content:

<html>
<head>
    <title>Lorem ipsum</title>
</head>
    <body>
    <div id="sidebar">
        <section>
            <p>The post on this page is a <?php if (in_category('apples')) { ?> <a href="http://mydomain.com/category/apples/" rel="nofollow">apples</a> blog post.  <?php } else { ?> <a href="mydomain.com/category/pears/" rel="nofollow">pears</a> blog post. <?php }; ?>.  You can browse the <a href="http://mydomain.com/archives/" rel="nofollow">Archives</a> to find more articles of this type.</p>
        </section> <!-- post-metadata -->               
        <nav>
            <h2 class="sidebar-title">Previous</h2>
                <ul><li><?php previous_post_link('<strong>%link</strong>'); ?></a></li></ul>
            <h2 class="sidebar-title">Next</h2>
                <ul><li><?php next_post_link('<strong>%link</strong>'); ?></a></li></ul>
        </nav>  <!-- post-navigation -->
    </div>
    <div id="content">
        <article id="post-<?php the_ID(); ?>" class="post" role="main">
            <header>
                <p class="post-date"><time datetime="2009-09-04"><?php the_time('F jS, Y') ?></time></p>
                <h1>
                    <?php the_title(); ?>
                </h1>
            </header>
            <?php the_content(); ?> 
        </article> <!-- post -->

        <section id="comments">
            <?php comments_template( '', true ); ?>
        </section>  <!-- comments -->

    </div> <!-- content -->
</body>

The way I'm trying to solve the issue is by running a separate loop in the sidebar (sidebar-single.php), rewinding and then running it again in the contents section (single.php).

Unfortunately, while the data from the first loop is diplaying correctly in the sidebar, the loop doesn't rewind for some reason and as a result the content for the next post displays in the content part of the page. See an example here.

Any ideas as to how the non-rewinding issue in this setu pcan be fixed, or alternatively how the objective can be attained by other means?