0

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>
5
  • 1
    Try removing the first "wp_reset_postdata ();" Commented Jul 22, 2013 at 2:35
  • @DavidKryzaniak it worked!! That only took 5 secs to erase and 6 hours of googling. Virtual Hug, Thank you.
    – Abi
    Commented Jul 22, 2013 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
    Commented Jul 22, 2013 at 2:46
  • Sorry, I wasn't sure if it was going to be this easy to solve. :) Commented Jul 22, 2013 at 2:48
  • 1
    No apology necessary. Sometimes the easy solutions are the hardest ones to find.
    – Pat J
    Commented Jul 22, 2013 at 3:42

1 Answer 1

1

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

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.