• OK, here is the situation. I use the following loop in order to have blog posts appear in the index.php except for the category ‘pensees’.

    Then the latest blog from that category is displayed in the sidebar.php (which is called before in the loop).

    sidebar.php:

    <?php $my_query = new WP_Query('category_name=pensees&showposts=1'); while ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate = $post->ID; ?>
    <?php the_content(__('(more...)')); ?>
    <?php endwhile; ?>

    index.php:

    <?php get_sidebar(); ?>
    
    <?php if (have_posts()) : while (have_posts()) : the_post(); if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?>
    <?php if (in_category('7') && is_home() ) continue; ?>
    <?php the_content(__('(more...)')); ?>
    <?php endwhile; else: ?>
    <?php endif; ?>
    
    <?php get_footer(); ?>

    Here is the problem. It seems to work fine but it breaks one of my plugin. So I would like to know if there was an alternate way to achieve this multiple loop.

    Please also note that when I call sidebar.php after the index.php’s loop it works perfectly but mess up the design.

    Any suggestions!?

Viewing 3 replies - 1 through 3 (of 3 total)
  • How does moving the sidebar call after the index loop screw up your design? Does it flip the columns?

    You should be able to tweak your stylesheet to move the sidebar to where you want it, regardless of where it is in the code.

    Thread Starter supergab

    (@supergab)

    OK I modified the CSS and it’s all good now. Thanks.

    No problem, I have had to do something similar to a theme to push the sidebar up in the code to improve the accessibility of the site.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Would like to try an alternate loop suggestion please.’ is closed to new replies.