have_posts() function of Class Reference/WP Query is limiting access to only 5 p
-
Is there limit for Class Reference/WP Query… In the code below I want to display all post having values 7 to 10 for custom field ‘Relevance Scale’. Though I have several (10+) posts with values ranging from 7 to 10 for custom field ‘Relevance Scale’ the code is displaying only 5 posts. Let know the cause. FYI The code will be used on site DigitalMarketingDesk.
<font font face="cursive" color="DarkGoldenRod" font size="2";> <?php //your code here! //Display posts where the custom field key is 'Relevance_Scale' and the custom field value is '9': $args = array( 'meta_key' => 'Relevance_Scale', 'meta_value' => array ('7','8','10'), // 'meta_compare' => '!=', //'orderby' => 'meta_value', ); $query = new WP_Query( $args ); // The Loop if ( $query->have_posts() ) { while ( $query->have_posts() ) { $query->the_post(); echo '<b><a href="' . get_permalink() . '">' . get_the_title() . '</a> </b><br/>'; // To display Relevance Scale $mykey_values = get_post_custom_values( 'Relevance_Scale' ); foreach ( $mykey_values as $key => $value ) { echo " <b>Relevance Scale = " ."$value <br /> </b>"; // To display Relevance Scale } } } else { // no posts found echo "No Posts"; } /* Restore original Post Data */ wp_reset_postdata(); ?> </font>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘have_posts() function of Class Reference/WP Query is limiting access to only 5 p’ is closed to new replies.