I am showing posts by shortcode into posts/pages of WordPress, and want to show an infinite list of posts, but it is showing only 10 posts.
Here is my code; please guide me what is wrong with my query.
$args = array( 'post_type' => 'post', 'cat' => '2', 'meta_key' => 'issue_of_article', 'meta_value' => $issue, 'posts_per_page' => -1, 'orderby' => 'artcle_category', 'order' => 'ASC');
$loop = new WP_Query( $args );
if ( $loop->have_posts() ) {
while ( $loop->have_posts() ) : $loop->the_post();
$loop->the_post();
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
endwhile;
}
Just add this in your argument
'posts_per_page' => -1
then you are done.
One more thing: you can change the default setting from admin to something other than 10. Go to the WordPress admin - Settings - Reading. There is an option like "Blog pages show at most". Type there the number of posts you want as the default.
Go to settings menu in the admin page
Settings -> Reading Change the value for Blog pages show at most.
It will work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With