Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Center area post/pages (http://forum.bytesforall.com/forumdisplay.php?f=32)
-   -   Custom Query - MCCQ (http://forum.bytesforall.com/showthread.php?t=19017)

rickheck Dec 1, 2012 01:01 PM

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.


juggledad Dec 1, 2012 07:45 PM

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.

rickheck Dec 1, 2012 09:44 PM

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:


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.



juggledad Dec 2, 2012 03:59 AM

the value for cat should be in quotes, so it should be
HTML Code:


rickheck Dec 2, 2012 12:57 PM

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 12:34 PM.

Powered by vBulletin® Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.