Knowledgebase
Display any Number of Posts in a Loop
Posted by Susan Tyson on 08 June 2016 05:57 PM

Did you ever want to display a different number of posts on different pages. For example on your category pages, you want to display 10 posts which you can control from your Admin panel, but another page you want to show only 5 posts. Well this tutorial is just for you.

Open a Template file where you want to display an x number of recent posts:

 
01 // if everything is in place and ready, let’s start the loop
02  
03 // to display ‘n’ number of posts, we need to execute the loop ‘n’ number of times
04 // so we define a numerical variable called ‘$count’ and set its value to zero
05 // with each iteration of the loop, the value of ‘$count’ will increase by one
06 // after the value of ‘$count’ reaches the specified number, the loop will stop
07 // *USER: change the ‘n’ to the number of posts that you would like to display
08  
09 if ($count == "n") { break; }
10 else { ?>
11  
12 // for CSS styling and layout purposes, we wrap the post content in a div
13 // we then display the entire post content via the ‘the_content()’ function
14 // *USER: change to ‘‘ to display post excerpts instead
15  
16 // here, we continue with the limiting of the number of displayed posts
17 // each iteration of the loop increases the value of ‘$count’ by one
18 // the final two lines complete the loop and close the if statement
(0 vote(s))
Helpful
Not helpful

Comments (11)
Lettie
13 July 2016 08:06 PM
Yea I am having the same problem but you see there is a minor dieecrfnfe with mine, it is the torrented Game of the Year edition. I would really like some help.  |Â
Vinnie
13 July 2016 08:49 PM
"A wojna fińska AD 1940 zaczęła się od ostrzelania Leningradu przez fińską artylerię." Ten dowód przekona wszystkich. Ale czy Pan ma jeszcze jakieś dowody tego, że w wojnie Krymskiej agresorem była Rosja? Fool me once, shame on you; fool me twice, shame on me.rozdPawiam,
Cherilynn
14 July 2016 04:59 PM
This piece was cogent, <a href="http://lpmtrd.com">weilewrltt-n,</a> and pithy.
Nephi
17 July 2016 01:39 PM
Short, sweet, to the point, FRte-ExacEly as information should be! http://fwpxixoqlgq.com [url=http://yncuok.com]yncuok[/url] [link=http://kigvhuadok.com]kigvhuadok[/link]
Cannon
17 July 2016 01:39 PM
Finding this post has aneerswd my prayers http://jmdnak.com [url=http://mtmolsdihjj.com]mtmolsdihjj[/url] [link=http://ezxbnjxttg.com]ezxbnjxttg[/link]
Ladainian
18 July 2016 08:23 PM
This has made my day. I wish all <a href="http://wvvlfkq.com">posignts</a> were this good.
Bert
18 July 2016 08:23 PM
Full of salient points. Don't stop <a href="http://trvccqs.com">beeinvilg</a> or writing!
Dina
19 July 2016 02:06 AM
An answer from an expert! Thanks for couritbnting. http://dhmgsel.com [url=http://ubsknvvlgm.com]ubsknvvlgm[/url] [link=http://cthcfpabl.com]cthcfpabl[/link]
Luck
19 July 2016 02:06 AM
I see, I supospe that would have to be the case. http://gqnbtgdipw.com [url=http://rzuzydxfb.com]rzuzydxfb[/url] [link=http://mitxvbns.com]mitxvbns[/link]
RobertAbarO
19 January 2017 09:04 AM
The best fitness tip for building up your arms is to work opposite muscles in opposite sets of each other. The best example would be to work the triceps and then the biceps. Each has the opportunity to rest while the other is being worked. This minimizes your time and maximizes your workout.

<a href=https://www.acheterviagrafr24.com/>https://www.acheterviagrafr24.com/</a>
CaseyTof
09 October 2017 10:08 AM
Some people, especially those running on busy daily schedules tend to use the pills to help maintain weight since they can not afford to follow all the diet programs. This is not advised. It is recommended that one seek advice from a professional in this field before using the pills. This can save one from many dangers associated with the misuse.

The diet pills should always be taken whole. Some people tend to divide the pills to serve a longer period of time. This is not advised and can lead to ineffectiveness. If it is required that one takes a complete tablet, it means that a certain amount of the ingredients are required to achieve the desired goal. It is also recommended that one does not crush the pill and dissolve it in beverages. Chemicals found in beverages have the potential of neutralizing the desired nutrients in the pill thereby leading to ineffectiveness. The best way to take the tablets is swallowing them whole with a glass of water.

The diet pills speed up the metabolic processes. This is the key factor that leads to the burning of all the fats in the body. This means that one passes out lots of urine, which subsequently leads to dehydration. It is imperative that the user take lots of water round the clock. This will help curb dehydration, which can lead to health problems. In addition to that, water offers the required medium for the function of the nutrients and elimination of the fats.

When buying the review of diet pills, it is imperative that one gets the most recommended dose. People tend to compromise the quality and effectiveness of the tablets due to the variation in cost. The low priced pills depict poor quality, which means their effectiveness is not reliable. Some have also been found to cause health problems. The dose should also be taken as recommended. Over dose will not speed up the process but rather lead to complication. This will increase risk of side effects. If the taking of the pill is forgotten, do not take more to compensate for the lost time.

The diet plan enclosed with the diet pills has also to be followed. According to the requirements, the termination of the diet must be done even with no results. This means your body is irresponsive.
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).