"wp-query" ambiguously refers to one of two things. 1) WP_Query is a class native to Wordpress which allows users to query the posts database using a number of criteria. 2) $wp_query is the default object that holds the main query object on each WordPress page.

learn more… | top users | synonyms

1
vote
1answer
143 views

posts_per_page option limits the number of Gallery items

I have noticed that if I have a query where posts_per_page are set to 4, any (image) gallery that belongs to one of those posts will too have only 4 items (although when I create the gallery from Add ...
0
votes
2answers
645 views

How to query posts based on lat-lng coordinate as post meta?

I'm planning a custom WordPress theme where the Custom Post Type (CPT) will have latitude and longitude coordinate as it's meta value. The latitude and longitude will be displayed as a Marker in a ...
0
votes
2answers
770 views

Exclude some authors from query

This script list users with their last post. How to exclude some authors from guery ? <?php //List of users sorted descending by date of lastest post written by user $uc=array(); ...
1
vote
2answers
428 views

Selecting all posts from the children of a particular parent taxonomy

I've created a custom post type (minerals) with a custom taxonomy (location) which supports hierarchies. What I am trying to do is create a return according to the parent location of the mineral post ...
0
votes
1answer
251 views

Include subtitle display to slideshow

Thanks to Author for this plugin. But There is no option to display subtitle. There is only 2 options - Title and excerpt. Help me change excerpt to subtitle. I use this function to display subtitles ...
2
votes
1answer
6k views

How to get an array of post data from wp_query result?

When run a query with WP_Query method, I got an object. I understand that I can then do the loop to display stuffs. But, my goal is not to display anything, instead, I want to get some post data by ...
0
votes
1answer
213 views

Is wp_reset_postdata always necessary?

After run a query $posts = (array)new WP_Query($args); I use this data to do some calculation on post meta. I didn't display the posts. Do I still need to use wp_reset_postdata after the query?
0
votes
1answer
172 views

Loop issues when creating custom query for media uploader

I'm working on a theme for a magazine publisher who routinely deals with a large number of images. I need them to be able to associate each image with a contributor (photographer, illustrator, artist, ...
0
votes
1answer
98 views

get latest added term from taxonomy and insert into php variable

I have a taxonomy called mailers And I am adding new terms to this taxonomy on a monthly basis. For example these are my 4 recent terms (slugs) I have added... 'august-2012-newsletter' ...
0
votes
3answers
1k views

Use Ajax To filter posts?

Right now I'm submitting a drop-down form to it's own page (action="") to filter posts displayed. I'd like to not have to refresh the page, which resets the forms. Is there a way to query ...
0
votes
1answer
112 views

meta_query returning excluded result

I have a series of day slots per location, in a multicheckbox custom field. I have a search page where the user can select location, weekday desired, and activity type. Right now I just have 2 ...
0
votes
1answer
797 views

WP_Query: attachment image in “full” size?

I'm using the following script for my current project. $query_images_args = array( 'post_type' => 'attachment', 'post_mime_type' =>'image', 'post_status' => 'inherit', ...
2
votes
2answers
925 views

Count total number of post in foreach loop

I used the the following script (only with get_permalink....) to display posts from a post type where the post author has an extra meta field on his user page: <?php // get users from user page ...
0
votes
2answers
2k views

wp_query a single custom post type?

How does one get a custom post by id? FYI: I am passing a particular post id through a form and it's performing an ajax call. I'd like to retrieve just one post and grab the title: <?php // E.g. ...
1
vote
3answers
54 views

custom post type search by reference id

I have a custom content type of tab_content with a relationship to a page. In my current script I have the id of a page and I want to do a query that will list all the children of type tab_content ...
2
votes
1answer
358 views

wp_query() get_col error

I'm trying to create an auto search jQuery function by using AJAX to send data to the database and back to the search field. In my wordpress theme, I create a folder called "include" and in there I ...
0
votes
1answer
170 views

Help with a query not working with custom taxonomy

The query below is always returning the latest "news" post, not the latest "news" post with the taxonomy "sotm". I have verified the details of my custom taxonomy, name is "postCat" attached to post ...
2
votes
2answers
459 views

Pagination Issue: Custom Post Type In Index

I'm using a template, which uses Custom Post Type 'movies'. When I try to change the page I got 404 Not Found :( This is my index.php <div id="content"> <?php $temp = $wp_query; $page = ...
1
vote
1answer
479 views

Display tags that only appear in one category

I'm trying to get this less manual than it currently is. I want to display tags that appear in only a single category, so if they are in a post that has two categories, I want that tag ignored. The ...
2
votes
2answers
1k views

$wp_query->queried_object->ID throws warning: Undefined property

<?php $current_term = $wp_query->queried_object->name; $current_term_id = $wp_query->queried_object->ID; ?> <hgroup ...
1
vote
1answer
8k views

wp query to get child pages of current page

Can anyone please help me to with the wp_query. I am making a template file/loop to create and archive page of the current page children pages. This query needs to be automatic as I am using in on ...
0
votes
2answers
184 views

Custom Query Fields - Altering Meta Value

I'm giving Custom Query Fields a shot for filtering/sorting posts on the front-end of a site. The instructions seem pretty self-explanatory, but I do have another layer that I'm trying to figure out. ...
1
vote
0answers
295 views

Does the WP_Query 'private' argument for post status only apply to privately published content?

The only peice of code that I can find that applies to this is on line 2430 in query.php in WP 3.4.1 foreach ( get_post_stati() as $status ) { if ( in_array( $status, $q_status ) ) { if ( ...
1
vote
1answer
407 views

Meta_query with or without value

I am using WP_Query to sorting the post by user input. The input contains meta value which is display in select type field. Normally when there is value inserted into the form, the wp_query working ...
4
votes
0answers
135 views

Custom query incorrectly returning everything [closed]

I'm missing something somewhere, but I cannot connect the dots. Everything outputs properly except that the query returns everything from the DB, not just posts. Can anyone spot a reason for this ...
1
vote
0answers
169 views

Query most popular terms by taxonomy over 2 week period

I have written SQL for a query that pulls the most used taxonomy terms for selected taxonomies that are published, do not have a parent post are not in a comma separated list over the past two weeks ...
1
vote
2answers
497 views

query user display_name failed in a custom mysql query foreach

I met some trouble. I tried to get user display_name in a custom mysql query foreach, but it failed. I have tried three method. new WP_User, get_user_by and get_userdata. but they only can get back ...
1
vote
0answers
73 views

Get page content by category or tag

I'm trying to sort of emulate the Views behaviour in Drupal with Wordpress, but doing it in theme templates. Now, I have pages that are assembled by using wp_query in the template to get posts ...
1
vote
0answers
402 views

How to use Meta Value Compare in WP_Query For Max and Min numbers

I am using WP_Query for visitor to filter the posts. The posts is about products. So in the filter, it has a field where user can select Maximum price and Minimum price. (Just like most of the ...
0
votes
1answer
48 views

Fourth page of custom post type archive page does not exist

I recently developed a custom post type for my company's blog, so that we could have a separate press area. In the archive-presse.php page I make a query, thus : $paged = (get_query_var('paged')) ? ...
1
vote
0answers
84 views

Posts published last 10 minutes

i have a "featured" section on home page. i want to hide this section after 10 minutes of post publish time. here is the code, i am using. problem is that it hide the "featured" section after 12 ...
2
votes
1answer
966 views

wp_query custom post type by taxonomy & standard post by taxonomy

Anyone know how I can neatly combine a query to pull CPT by a custom taxonomy and also standard posts by taxonomy into same query to list all posts together on my home page? for example: $args = ...
0
votes
1answer
410 views

WordPress | Date not always appear [duplicate]

Possible Duplicate: WordPress the_date() not working I try to create a theme. In that theme I have create a custom post type and I quering the WordPress by using the wp_query to get the ...
1
vote
1answer
704 views

Custom Query num_rows returns wrong amount

So I have a custom query that fetches all posts in a given category. I am trying to get the number of rows returned but it is giving me the wrong number. Instead of 11, I am getting 14. Does anyone ...
0
votes
2answers
207 views

Transient api Caches confused

This code works for page 1 <?php $paged1 = (get_query_var('paged')) ? get_query_var('paged') : 1; $recent1 = get_transient( 'recent1' ); if ...
2
votes
1answer
154 views

Sort by posts that have a featured image?

I'd like to sort posts on the index page to show those that have a featured image first. I've done this in functions.php: add_filter( 'pre_get_posts', 'my_get_posts' ); function ...
0
votes
1answer
67 views

For what queries is conditional tags informative?

I think it's great to use conditional tags but if the query is slightly advanced it won't give information about the original query. For example; is_category('apple') might give a false response if ...
2
votes
1answer
1k views

Using custom meta_query with relation not working as expected

I am trying to create a query to pull future events only. It was working great until the client requested the ability to add date ranges--so the event will either have a start date only, OR a start ...
0
votes
1answer
109 views

Can't query by meta_key

For some reason. I do not have the ability to query by meta_key when I run a loop. What could cause this and what can I do to the diagnose the problem? I am using wordpress 3.4.1. $args = array( ...
0
votes
1answer
492 views

the_category() doesn't working in wp_query loop

I'm using custom post type. I want to show every post's the most child category on archive page in wp_query loop. But the_category(''); doesn't work. What should I do? I need your help. Sorry for my ...
0
votes
1answer
572 views

paginate_links() on page (shortcode output)

On a standard WordPress page, I have a WP Query that runs through a post type I created. Along with that query, I am using paginate_links() to generate pagination. While the standard (no permalinks) ...
0
votes
1answer
136 views

Adding pagination to sub-wp_query within a singular post page

So my custom wordpress theme/site has a number of venues, e.g. "foo" which has a number of events and reviews. So a venue ends up with a URL like, http://www.example.local/places/my-place-name/ ...
2
votes
4answers
88 views

Get list of WP Updates Across Sites

Is there a way to query a WP site to see the number of updates currently available? I'm not really looking for a list of the actual updates, just the number. This would be the total number of ...
0
votes
1answer
59 views

wp_query: implicit paging? I get less posts that I should

A newbe wp_query question: I set a wp_query as follows, but instead of 17 posts I only get the first 10 posts from the selected Category with ID=5. Is there an implicit paging directive on the ...
1
vote
1answer
107 views

Sort query by author: 1 author, then others

I have a post type called 'article' and on the article archive page i'd like to show all the articles, sorted by author. function kia_adjust_the_query( $query ) { // change posts_per_page ...
5
votes
2answers
1k views

Usage of the new “posts_clauses” filter in Wordpress 3.1?

Just noticed that 3.1 added a new filter to customize queries: posts_clauses. All I could find about it is that instead of using the separate query filters like posts_where or posts_join, you can ...
1
vote
1answer
138 views

Query by multiple meta elements not seeming to work - wordpress is timing out

Trying to run a query that pulls: get me 4 posts or pages that are not in sticky_posts and have (my_featured_post = 1 AND photo-image_post_id > 0) OR (my_featured_post = 1 AND photo-image_page_id ...
2
votes
3answers
932 views

post_type is ignored by WP_Query when 'tag' argument is included

I've created a function to call in a page template, inside of which is the following query: $custom_news = new WP_Query(array( 'post_type' => array('post', 'resource', 'job'), ...
1
vote
1answer
247 views

Pull post meta with post_query?

I'm building a custom index loop that just uses query_posts at the moment. The issue is that inside The Loop, I have to then query for the post meta data (with get_post_meta), which I believe has ...
0
votes
1answer
107 views

wp_pagenavi on WP_Query using customfields

I have been searching this subject for some time now, not finding a solution. First of all, sorry for my bad spelling. Im quit new to PHP, so please be gental. Im using this to list some ...