"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
2k views

Display all posts for taxonomy term across multiple custom post types

I'm currently creating a website that uses several content types, (e.g. books, movies, shows) as well as a key taxonomy term (e.g. status, with values of owned and wishlist). My question is, in a ...
0
votes
1answer
4k views

All-in-One Event Calendar: Custom Query - Getting each event Instance [closed]

I am using the All-in-One Event Calendar by Timely, and I would like to display upcoming events from the events calendar in a carousel on a separate page, and I need to get the event information. I ...
0
votes
3answers
177 views

Show only one category in main query, issues on tag page

I altered the following code from Ashfame: add_action('pre_get_posts', 'block_cat_query' ); function block_cat_query() { global $wp_query; if( is_home() || is_search() || is_tag() ) { ...
1
vote
2answers
895 views

Wp_query: sort by PHP variable

Here is my problem: For my articles, I use a custom post type "exhibitions" and posts for all other news. I am displaying them in one query ['post_type' = array('exhibitions','posts')]. The orderby ...
0
votes
1answer
119 views

Paginate wp_query while utilizing post__not_in

I'm currently running a wp_query like this: <?php $the_query = new WP_Query( array( 'post_type' => 'photos', 'posts_per_page' => '2', ...
0
votes
2answers
518 views

How to use WP_Query() on single.php?

I'm using WP_Query() to pull out a few posts under a specific category "Featured" to display at the bottom of any post. So I added <?php if (function_exists('getEditorPicks')) ...
0
votes
1answer
48 views

Avoiding page loop

I'm doing a custom page that has multiple wp query calls, the thing is that I don't need the main query that is I don't need anything from the page contents, so in order to save load time I was ...
0
votes
1answer
903 views

Loop through Custom Post Type, and then show children within each iteration

I am currently using WP_Query to loop through a custom post type, and only showing the parent posts like so: <?php $loop = new WP_Query( array( 'post_type' => 'programs', ...
1
vote
2answers
18k views

How to display page content in a page template?

In my WordPress site, I made a custom page template, which contained a custom query [using WP_Query()]. With that query, I can perfectly get the posts of a certain category. But I want to show the ...
0
votes
1answer
393 views

new WP_Query issues

My default wordpress set hold 10 posts per page. In category.php , I want to override this with 999 post per page, the problem is that isn't working at all. When I use the following code. it ...
1
vote
1answer
83 views

how to get all the child category name in a specified category name?

Supposed the specified category name is "product", which has three layered sub-categories. The structure is like the following: product one product two product three product four I want to ...
0
votes
1answer
223 views

wp_query and comment_parent - select only posts with top level comments

I have a custom post type of 'films', and I'm creating a number of search filters using wp_query. All are working fine, but I now need to add in an option of exclude results that dont have any top ...
0
votes
1answer
323 views

Custom post types loop on a page template

Hi I'm trying to make a page template that shows a list of a custom post type ordered by a meta key, I easily made it with query_posts but I am trying to do it via pre_get_posts so I made a function ...
2
votes
1answer
153 views

Understanding the use of wp_reset_query();

I am not able to understand why we need to use wp_reset_query(); could anybody explain me? global $more; $more = 0; query_posts('cat=3'); if(have_posts()) : while(have_posts()) :the_post(); ...
2
votes
0answers
197 views

Warnings in nav-menu when visiting query pages

Using query-wrangler, similar to drupal's views, I created some query pages. When I visit these pages, in the top-navigation-menu there is this warning: Warning: in_array() expects parameter 2 to be ...
0
votes
1answer
156 views

Query Users by post count, last 30 days and display each users post count according to post type

I'm almost done, the code below does everything but display post count for each user broken down into post types, and also I'm like to filter it last thirty days. I'm trying to get the post for each ...
0
votes
1answer
565 views

Query custom posts from custom taxonomy

I'm trying to do a custo slideshow, but I have problems with query the posts. I have defined a custom post type "slider" and a custom taxonomy "slideshow": custom post type: function ...
0
votes
1answer
324 views

Set tax_query conditionally with new WP_Query

I have a page template with a custom query: <? $filter = explode(' ', $_GET['filter']); // "page/?filter=taxonomy+term" $paged = get_query_var('paged') ? get_query_var('paged') : 1; $query = new ...
0
votes
2answers
467 views

Any way to include custom fields in WP_Query results?

Looking for a way to include custom fields in the output of WP_Query. I am managing a site where nearly every post type has a lot of custom fields defined and it would be much nicer not to have to run ...
1
vote
1answer
136 views

Gallery shortcode numerical sorting

When I try to sort a Gallery created through the [gallery] shortcode by numerical titles I get them sorted in alphabetical order. That means that they are sorted like so: 1, 3, 34, 4, 56, 6, etc. ...
4
votes
1answer
2k views

How to paginate wordpress [gallery] shortcode?

I am using wordpress gallery shortcode [gallery] I was wondering if there is anyway to paginate them without using a plugin.
1
vote
3answers
76 views

Trouble Making WP_Query paged

I'm using the query below in the index.php file as the main query, whenever I try to go to the 2nd page I get a 404 error, I tried using posts_per_page but to no avail. <?php $args = array( ...
1
vote
2answers
2k views

WP_Query most viewed posts, in multiple Post Types, last 30 days, excluding a specific taxonomy term

OK so I'm about 90% done, the only part that keeps breaking is when I try to exclude a specific taxonomy term. Break down: Sorting: ('v_sort' => 'views') This is being done via the popular ...
2
votes
2answers
3k views

Query posts only with featured image

I want to query 6 posts, but only those which have a featured image attached. I am using meta_key method for this with WP_Query as such: $args = array( 'post_type' => 'post', 'meta_key' ...
0
votes
1answer
807 views

WP_Query orderby not working with meta_value_num and menu_order

I have made a custom post type (sidebar_element) which are shown on sidebar. On each sidebar element admin can choose where in sidebar should that element be shown, ie. 'top', 'middle' or 'bottom', ...
0
votes
1answer
398 views

reorder a WP_Query, using a dropdown

I have the following loop used to display posts by category & I would like to to re-order them based on a dropdown selector if (!isset($qry)) $qry = new ...
0
votes
1answer
180 views

meta_query fails to compare on values containing apostrophes

I have WP Query and I am simply comparing by the meta value by = My value contains town names, and seems to work great for the majority of names. However some names contain apostrophes... Madonna ...
0
votes
2answers
668 views

problem in query_vars parameters

I've a problem. I've tried a lot of things but I could not find a solution. I use query_vars parameters in this page and there isn't any problem. But i don't use different parameters or the same ...
-1
votes
1answer
613 views

Reduce Database Queries in Code [duplicate]

Can i reduce the queries by compresing this ?, cand i reduce queries, if i can , how can i do? Note : The images are in diferent size http://oi55.tinypic.com/rwp3ex.jpg <div ...
0
votes
2answers
14k views

Show all products on one page with WooCommerce

I have WooCommerce running on this store. Although the default is to show 12 products on a page the client has asked for a "show all" button that will prevent the user having to use pagination to get ...
1
vote
1answer
111 views

Limit Tags display and ad Drop Down Menu

Does anyone have any idea on how i can limit the number of tags shown in a post and if there is more it's a drop down menu. Here's an example of what i mean. Se where it sats "More On" those are ...
2
votes
1answer
1k views

How to sort CPT by custom meta value (date), and return posts month by month

For future reference: I am using the great Meta Box Plugin to help expedite meta box creation for my custom post types. My goal: To build a highly customizable events section closely resembling a ...
0
votes
1answer
161 views

Paginated WP_Query doesn't return 404's, even when posts don't exist

I'm currently building a theme for a client, and one of their requirements is endless scrolling on a "Charts" page. They want this to be paginated, and the endless scroll to load the next page below ...
0
votes
1answer
47 views

How to number the posts (ie #1, #2, #3) in a wp_query?

What is the best way to display the appearance number of a post in a query? For example, if a post is the first listed print #1. If it is third, print #3. Any direction is appreciated!
0
votes
1answer
334 views

Query posts by Custom Meta (checkbox) & Genesis Grid Loop

I've been trying tons of things for the last 2 days. I'm at a standstill now. I read a ton of posts here but nothing has worked yet. I have a CPT 'artists'. This CPT contains a custom field ...
0
votes
1answer
405 views

Why can't I use an array of term slugs in WP_Query?

In WP_Query, a comma-separated list of term slugs works fine: $query = new WP_Query ( array( 'customtaxonomy' => 'term1,term2' ) ); ...but an array of slugs causes a warning: $query = ...
0
votes
2answers
134 views

wp_query not resetting, last post hanging

im creating a wordpress query for custom taxonomy. However im unable to get the last post that i queried to go to the permalink. Please could somebody help me get this query right, much appreciated in ...
-1
votes
1answer
21 views

Are custom posts included when getting a categories' posts?

Would WP_Query('cat=1') display custom post types, or is that something that I have to specify? I have a custom post type, am assigning it to a category, and would like for it to be displayed when ...
0
votes
3answers
3k views

WP_Query orderby taxonomy term value (numeric)

I have this query... <?php $press = new WP_Query(array( 'posts_per_page' => -1, 'post_type' => 'individual', 'post_status' => 'private' )); ...
1
vote
1answer
1k views

WP_Query: query posts by ids from array?

I did quite a bit of research but can't figure why this wouldn't work for me? echo print_r($rel); // Array ( [0] => 63 [1] => 87 ) $args = array( 'post_type' => array( 'post' ), ...
0
votes
2answers
1k views

Pagination on category.php and tag.php not working

i'm using a query-loop on my template pages like this: <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $wp_query = new WP_Query(); ...
0
votes
1answer
92 views

direct custom post query interferes with other queries on page

In a previous question, I was struggling with how to get my custom post type(s) to show when performing standard category/tag queries, since by default Wordpress doesn't include CPT's in these ...
1
vote
1answer
345 views

Pre_get_posts Gives 404 on Custom Post Type

I'm trying to filter the query on a sub page called "Ask Question" to list all of the recent questions submitted by users, but I get a 404 when going to the page. Flushing the permalink structure did ...
0
votes
1answer
170 views

WP_Query: Fetch posts that are in (category1 and not in category2), OR posts that are not in cagegory1

I have two categories that will always stay the same. They are called "Events" and "Show on frontpage". The latter is a child category to Events. What i want to do is, when fetching posts (using ...
0
votes
1answer
228 views

Single post - display list of all posts + specific post

my single post looks like that: http://pastebin.com/KdEbs82P I want to display on single post two things: list of ALL posts in general single post title content What I achieved right now is not ...
1
vote
1answer
925 views

How to query a custom post type with a taxonomy filter but display post type archive page?

I'm filtering the main query of Jigoshop with my own taxonomy with this hook (The file responsible for Jigoshop queries that I'm hooking, Jigoshop hooks onto WP 'request' filter): add_filter( ...
0
votes
1answer
7k views

List all custom post type posts from a given category?

I have a custom post type myposttype and it's taxonomy is called myposttype_categories. myposttype_categories have multiple terms inside, such as foo and bar. The tricky question is - how do I list ...
1
vote
1answer
704 views

Recent Posts slider, using WP_Query(), loads duplicate sliders

I have written a small piece of code for Wordpress that will show the most recent top 4 posts in a slider (the Filament Group Responsive Carousel). It works, displaying the posts and sliding them etc, ...
1
vote
1answer
90 views

Keep sticky posts out of query unless they have featured image

I have a query running which prevents posts without various criteria from appearing, one of these is the necessity to have a featured image. Sticky posts however seem to end up in the query ...
0
votes
2answers
1k views

Setting get_queried_object

I know that get_queried_object contains the object that was queried for the current page. My question is, what methods of querying affect the contents of this? For instance: query_posts get_posts ...