WP_Query is only looping home page, not pages

So I am writing a wordpress loop and I want my loop to call the latest fifteen Pages (Not using any post whats so ever and its not an option) then I am looping through the LI tag and Span tag to populate the thumbnail. If your confused check it out xxlbreakcomp.com

My loop works, but its only calling my homepage info.I think I either need to write a second loop or an output but I have done both and neither works.I kinda just need a push in the right direction but I am totally lost.

    <footer class="footer" role="contentinfo">

            <div id="inner-footer" class="wrap clearfix">

                <div id="video-thumbs">

                      <ul id="selected">    

                <?php

                $query_args = array (
                        'orderby' => 'date',
                        'order' => 'DESC',  
                        'post_per_page' => 15, 
                        'post_type' => 'page',
                        'post__in'=> array       (4,7,8,9,15,16,17,18,19,20,21,22,23,24,25)
                    ); 

                $query = new WP_Query($query_args);

                if ( $query->have_posts() ) :       

                    while ( $query->have_posts()) : $query->the_post();

                        wp_reset_postdata ();

                        ?>
                          <li data-permalink="<?php the_permalink(); ?>" class="selected">
                          <span style= "background: url('<?php bloginfo('template_directory'); ?>/library/images/thumb_pic.png')"></span>
                          <span><?php the_title(); ?></span>
                        </li>
                        <?php
                    endwhile;
                endif;

                ?>

                <?php wp_reset_postdata (); // reset the query ?>

                </ul>

                </div>

Related posts

Leave a Reply

1 comment

  1. You may be resetting the post back to the default post with the wp_reset_postdata call within the while loop. Try removing that to something like,

    if ( $query->have_posts() ) :       
         while ( $query->have_posts()) : $query->the_post();
             ?>
               <li data-permalink="<?php the_permalink(); ?>" class="selected">
               <span style= "background: url('<?php bloginfo('template_directory'); ?>/library/images/thumb_pic.png')"></span>
               <span><?php the_title(); ?></span>
             </li>
             <?php
         endwhile;
    endif;
    

    The final wp_reset_postdata after the loop looks ok.