Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Center area post/pages »

Custom Query - MCCQ


  #1  
Old Dec 1, 2012, 02:01 PM
rickheck
 
139 posts · Oct 2009
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..
  #2  
Old Dec 1, 2012, 08:45 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
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.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #3  
Old Dec 1, 2012, 10:44 PM
rickheck
 
139 posts · Oct 2009
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..
  #4  
Old Dec 2, 2012, 04:59 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
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
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #5  
Old Dec 2, 2012, 01:57 PM
rickheck
 
139 posts · Oct 2009
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.
Attached Files
File Type: txt rgh-ember-cat.txt (11.6 KB, 1681 views)

Bookmarks



Similar Threads
Thread Thread Starter Forum Replies Last Post
Juggledad's multi column/custom query wesleydeboer Center area post/pages 23 Feb 25, 2015 08:01 PM
Custom Query String horsemansarts Plugins & Atahualpa 1 Jun 30, 2010 04:39 PM
Displaying Posts Using a Custom Select Query Thomas Center area post/pages 0 Dec 28, 2009 09:14 AM


All times are GMT -6. The time now is 12:15 PM.


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