I am trying to develop a WordPress blog. I want the blog will show unlimited posts in one page. Posts will come from the default post item. I have used the following loop for that.
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php the_title();?>
<?php the_content();?>
<?php endwhile; ?>
<?php endif; ?>
But how can I set here -1
value for unlimited posts. Also -1
value not support in admin Reading Settings option. Please tell me the solution.
Something like this should work (not tested). I’m not sure about the context of your code snippet but assuming you’re instantiating a new WP Query:
Refer to this for “in loop” implementation: http://codex.wordpress.org/Class_Reference/WP_Query#Standard_Loop_.28Alternate.29
Make sure to wp_reset_postdata(); to be safe.
I would suggest you to do it with an Template file and write some custom query to display all post in one page:
like this:
Create a Template file
Now in admin select this template file to any page you want to display all post …
May this will help you, by overriding global
$wp_query
I have found the solution .