• I’ve been designing an FAQ section, where each question and answer is a post. I’ve designed a custom single page for the category and added a sidebar with a list of all post titles in that category (a list of all questions asked); these are also permalinks to those posts single pages. The title list is generated by the loop running a custom query:

    <?php $my_query = new WP_Query('category_name=FAQ'); ?>
    <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
    <h4 id="post-<?php the_ID(); ?>">
    <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
    <?php the_title(); ?></a></h4>
    <?php endwhile; ?>

    The links work fine and it jumpas to the right page, however when it gets to this line of code:

    <div <?php post_class() ?> id="post-<?php the_ID(); ?>">

    It takes the post ID from the last time the loop executed. In other words it is only ever the last post that is displayed.

    I’m sure there’s an easy way round this. Thanks in advance for any suggestions

  • The topic ‘Sidebar conflict’ is closed to new replies.