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.

Why does my loop always return "no posts" ? I've included all necessary files it seems. I'd like to use this page for ajax calls, but I cannot get it to work as a normal loop. If I use get_posts it works, but that's not what I need.

So far I've:

<?php
/* Define these, So that WP functions work inside this file */
define('WP_USE_THEMES', false);
require('../../../wp-load.php');
?>



<div id="container">
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <div class="movie">
        <a href="<?php the_permalink() ?>">
            <?php
                if (has_post_thumbnail()) {the_post_thumbnail('homepage-preview');}
                else {echo '<img src="' . get_bloginfo( 'stylesheet_directory' ) . '/images/default-poster.jpg" />';}
            ?>
            <p class="comments"><?php comments_number('0 review','1 review','% reviews'); ?></p>
            <div class="description">
                <h2><?php the_title(); ?></h2>
                <?php the_excerpt(); ?>
            </div>
        </a>
    </div>
    <?php endwhile; else: ?>
        <!-- No movies found -->
    <?php endif; ?>
</div><!-- End #container -->




<!-- pagination -->
<nav id="nav-below">
<?php previous_posts_link('<span id="prev_page">Previous Page</span>'); ?>
<?php next_posts_link('<span id="next_page">Next Page</span>'); ?>
</nav>
share|improve this question
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.