This is probably easy once you know but I'm having trouble getting the static page content to appear AFTER a list of posts.

I'm using a named page template which displays posts as a slider and I want to display the static content of the page underneath this slider.

To display the static content I've got this in my template:

<!-- display page content (if any) before blog posts -->
            <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

            <div <?php post_class(); ?>>
            <h1 class="title"><?php the_title(); ?></h1>

                <div class="entry">
                <?php the_content(); ?>

                </div><!-- /.entry -->
               <div class="fix"></div>

            </div><!-- /.post -->
            <?php endwhile; endif; ?>
<!-- end of page content -->

If I use this bit of code BEFORE the slider query/loop then my static content displays fine with the slider displaying the posts after. However if I use this snippet AFTER the slider posts then I just get a list of the slider posts - because of the query set up for the list of posts.

Basically, to show the static content after the slider posts I need to reset the query back to the current static page content somehow.

  • 1
    Please post the slider query code as well, is the content the same or separate?
    – Wyck
    Jul 15, 2011 at 22:51

3 Answers 3


wp_reset_query(); or consider saving your $wp_query result into $my_query = new WP_Query(); if( $my_query->have_posts(); etc. Just take a look at the codex page.

  • My only issue with this solution is that, if the OP is creating the second loop properly, then resetting the query won't be necessary. Better, IMHO, to create the second loop using current best practices, and avoid the need for wp_reset_query(). Jul 16, 2011 at 2:51
  • 2
    @Chip Bennet ..."or consider"... 2 solutions offered. Choose whatever you like better :)
    – kaiser
    Jul 16, 2011 at 3:21
  • 1
    I probably misread that at first, @kaiser :) Jul 16, 2011 at 12:45

Your slider needs to be created from a second, custom Loop. There are a few options, including using $my_query = new WP_Query(), however, generally speaking, my preference is to use $my_query = get_posts().

If you post your slider code, we can help you customize it properly.


Thank you.

I understand that ideally the slider code would have the custom query variable in order to keep the default data held in $post for later down the page but the slider is taken care of by my parent theme so I didn't want to change it. Instead I did this:

wp_reset_query didn't seem to do anything but the following worked...

I added this before my second loop (after the slider) to get the current static page:

$my_query = new WP_Query( 'paged=' . get_query_var( 'page' ) );

while ($my_query->have_posts()) { $my_query->the_post();
  • Please mark it as solution.
    – kaiser
    Oct 24, 2011 at 12:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.