Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.Plus the post__in array isn't working either.

            <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>
share|improve this question
1  
Try removing the first "wp_reset_postdata ();" –  David Kryzaniak Jul 22 '13 at 2:35
    
@DavidKryzaniak it worked!! That only took 5 secs to erase and 6 hours of googling. Virtual Hug, Thank you. –  Abi Jul 22 '13 at 2:42
    
@DavidKryzaniak -- You should post your comment as a solution, so that Abi can accept it, and this question can be marked as resolved. (Plus you get more whuffie that way.) –  Pat J Jul 22 '13 at 2:46
    
Sorry, I wasn't sure if it was going to be this easy to solve. :) –  David Kryzaniak Jul 22 '13 at 2:48
1  
No apology necessary. Sometimes the easy solutions are the hardest ones to find. –  Pat J Jul 22 '13 at 3:42
add comment

1 Answer

up vote 1 down vote accepted

Removing the first "wp_reset_postdata ();" solved the problem.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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