I have a site
You may recognize it, it’s a theme purchased here. It is working great, they love the site. My problem is this. Three of the people at the church wanted to have their own blogs. So I set up categories for them and then made a custom page for them. The pages are working fine. The issue is that I don’t believe all the code is working. For example. One of the blogs has 15 posts in it. I had the admin area set to display 10, yet only 5 displayed. Also, there is no navigation at the bottom to view older or newer posts even though he has enough posts to trigger this. Here is my code
The blog I am speaking about is here
First off, why are you messing with the code, why not just use the category for their ‘blog’ or filter it by author. Am I missing something here?
Your code is ‘wrong’ – You should use query_posts() instead and you have to add some more code to get the pagination working.
<?php $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; ?> <?php query_posts(“showposts=20&cat=15&paged=$paged”); ?>
Hope that helps
I recommend using WP_Query instead. http://weblogtoolscollection.com/archives/2008/04/13/define-your-own-wordpress-loop-using-wp_query/
- United States
- Was featured in a podcast
- Attended a Community Meetup
- Author had a Free File of the Month
- Bought between 50 and 99 items
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Has been a member for 5-6 years
- Contributed a Tutorial to a Tuts+ Site
- Contributed a Blog Post
I recommend using WP_Query instead. http://weblogtoolscollection.com/archives/2008/04/13/define-your-own-wordpress-loop-using-wp_query/Came here to say just that. Using the a WP_Query object makes custom loops really simple and customizable.
well, I am messing with the code because I can. It’s how we learn. I don’t remember why the site was set up the way it is. It was set up a while ago. I am sure I had my reason for doing it. Probably because it makes it easier to show the page. The code is made up of a custom page and then each blogger can post to a specific category that goes to that page. It works, it’s just not completly correct as you all already know. I will look into query_posts. Thanks for the links and the example.
well none of those options worked for me. The only way I can get it to display any posts at all is to use the code that I am using now. Nothing else has worked. I have been trying for hours with no success.
- Make a file for each 3 category using their ID’s. Like this: category-1.php, category-2.php, category-3.php
- Then make your custom adjustments for them. That’s all. And use default wordpress loop instead of your custom “foreach” one.