Disruptive Technology

RANDOM NEWS, TRICKS AND TIPS ON TECHNOLOGY

Pages

▼

Wednesday, 13 August 2014



How to limit post on wordpress 


 wordpress-logo
By default, the WordPress displays 10 posts per page. But in case you’d like to display more or less posts,
here’s how to do it.
The solution is simple:
You have to use the query_posts() function, which gives you a total control over the WordPress loop.
To specify how many posts you want to be displayed per page, we’ll use the showposts parameter.
Here’s an example:
<?php
$page_num = $paged;
if ($pagenum='') $pagenum =1;
query_posts('showposts=5&paged='.$page_num); ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
// WordPress loop
endwhile;endif; ?>
This example loop will displays 5 posts per page.
’.$page_num parameter
allows use to display our content by pages and use a paginator.
Unknown at 1:45:00 am
Share

No comments:

Post a Comment

‹
›
Home
View web version
Powered by Blogger.