Reputation: 17
I have a problem with showposts.
$recent = new WP_Query('showposts=10'); while($recent->have_posts()) :
$recent->the_post();
and I would like to change the number of "showposts" from the administration.
I found the instruction how to create widget in /wp-admin/ but i dont know how to create a simple form to change and save number of showed posts.
Thank you for your help.
Upvotes: 0
Views: 78
Reputation: 275
Under settings > reading in your wp-admin you have the configuration of how many posts will be shown in each page of your queries. You can just remove the 'showposts' parameter and the Wordpress will get the value configured in wp-admin.
Also, showposts is deprecated. You should now use 'posts_per_page' :)
https://codex.wordpress.org/Class_Reference/WP_Query#Pagination_Parameters
Hope it helps.
Upvotes: 2