Custom Query - MCCQ
I am using a variation on the MCCP template, and using the 'posts_per_page' value in the custom_query (as in "posts_per_page=4"). But the template doesn't seem to be using that value; all posts in the category are being displayed, not just 4 per page.
The template I am using is a modified version of Juggledad's template, but I can't find in my version (or the 1.4 version which I just downloaded again today) the part of the code that is using that custom_query value ("posts_per_page"). Whereabouts is that value in the custom_query processed? Note that the site I am working on is not publicly visible, so can't provide a link. Thanks...Rick.. |
If you don't specify it in the custom query, it will default to the number of post at 'dashboard->settings->reading->Blog pages show at most' option. To add it to the custom query use an '&' to set multiple variables. Read about custom queries in the WordPress Codex.
|
Thanks for the reply to both of you.
I output the value of the $mccq_args just before the query_posts() statement, and it shows this: post_status=publish&cat=8&posts_per_page=4&paged=0 That is the value that is in the custom_query field, plus the '&paged=0' value added by the code. So it would appear that the query is being 'built' properly, unless I have missed something (which is not unusual for me....) The 'cat' value is correct number, and the correct category of posts is being displayed; I just get all of the posts in that category instead of the 4 that I specified in the custom_query. Ideas? THanks...Rick.. |
the value for cat should be in quotes, so it should be
HTML Code:
post_status=publish&cat='8'&posts_per_page=4&paged=0 |
1 Attachment(s)
Thanks for the replies....
I looked at my template, and I don't see any extra queries. There are a few functions at the top that add my custom PHP code to the template, and a couple of functions that put a widget area in the top an bottom of the center column, but don't see any extra queries. I've attached the template I am using (as a text file). There is nothing in there that is proprietary, so no problems there. The custom_query values seem to work OK, since a query of that one category show only posts in that category. And I have other pages that use the same template for other categories, and those display the proper posts in the specified category. The category in this page is one that has 10 posts, but the query should only show 4. It's a bit puzzling, because I have used this template in other sites without problems. Thanks for your help. |
All times are GMT -6. The time now is 02:15 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.