Support » Fixing WordPress » numberposts is not working for me

  • <?php
    // args
    $args = array(
    	'numberposts' => 3,
    	'post_type' => 'earnings',
    	'meta_key' => 'article_category',
    	'meta_value' => 'Immediately Actionable'
    // get results
    $the_query = new WP_Query( $args );
    // The Loop
    <?php if( $the_query->have_posts() ): ?>
    	<ul class="frontnewsul">
    	<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
    		<li class="frontnewsli">
    			<a href="<?php the_permalink(); ?>"><div class="stksymnewshdln"><?php the_field('symbol'); ?></div><span class="frontnewslink"><?php the_title(); ?></span></a>
    	<?php endwhile; ?>
    <?php endif; ?>
    <?php wp_reset_query();  // Restore global post data stomped by the_post(). ?>

    The number of posts that is shown is ALL of them, rather than the 3 that I would like. Can anybody help out on this? I have this snippet of code on the front page. There are other loops going on in the front-page, not sure if that has anything to do with it.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘numberposts is not working for me’ is closed to new replies.