Wordpress Themes - WP Forum at BFA
Click Here To DONATE! Support the theme development, get more attention and additional benefits based on your donation level. Your forum name will be highlighted.

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

Custom Query - MCCQ


Build custom WP THEMES, without
coding.
Click here for THEMEFRAME

From the author of Atahualpa, the #1 most
downloaded (700,000+) theme @ wordpress.org
  #1  
Old Dec 1, 2012, 01: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, 07:45 PM
juggledad's Avatar
juggledad
 
22,263 posts · Mar 2009
OSX 10.8.5 WP 3.8.x Atahualpa 3.7.x Safari 6.x Firefox 25 XP
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, 09: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, 03:59 AM
juggledad's Avatar
juggledad
 
22,263 posts · Mar 2009
OSX 10.8.5 WP 3.8.x Atahualpa 3.7.x Safari 6.x Firefox 25 XP
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, 12: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, 172 views)

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Juggledad's multi column/custom query wesleydeboer Center area post/pages 17 May 10, 2014 08:55 AM
Custom Query String horsemansarts Plugins & Atahualpa 1 Jun 30, 2010 03:39 PM
Displaying Posts Using a Custom Select Query Thomas Center area post/pages 0 Dec 28, 2009 08:14 AM


All times are GMT -6. The time now is 06:35 PM.


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