"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

0
votes
1answer
92 views

Group WP_Query by meta_key date

I have a wp_query which lists posts from a custom post type, sorted by a custom field 'time'. I'd like to group this list by another custom field 'date', so that every post that has the same custom ...
0
votes
0answers
17 views

How to build new WP_Query using url

How to build a WP_Query using a url in wp_ajax_nopriv action. I have a following url for example: "http://example.com?paged=2 so I need to build a WP_Query which will retrieve a second page of posts. ...
0
votes
0answers
17 views

Multiple relationships for multiple tax_query in WP_Query

I want to use the WP_Query class to filter some of the posts. The website was built without using the "normal" wp posts but using a convoluted way to allow the users to easily add blog posts to ...
1
vote
1answer
3k views

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

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 ...
1
vote
1answer
51 views

echo a specific meta_key queried through a custom post

I'm new to coding but love tinkering around (on Virtual Server) with bits to upgrade my current website when I have the time. What would be really useful to me would be to post an individual ...
0
votes
0answers
16 views

Build query from the url given

I have an ajax request coming with parameter called "next_page_url" => "URL_FOR_THE_NEXT_SET_OF_POSTS" Now I need to build a WP_Query arguments using that url to respond to that AJAX request with ...
1
vote
1answer
1k views

WP_Query last five posts, simply ordered by meta_value

I can't believe I'm asking this question. It feels like such a simple method, yet I've poured over the WP pages and dozens of similar questions to no avail, so here it is... I've got a WP_Query with ...
0
votes
2answers
32 views

Wp_query…a type of term a different div

I need to create a table like this image and I want a specific term in particular DIV but with my code appear all together. Example: One div brown with the 5 products. The effect I want is like an ...
0
votes
1answer
14 views

How do I control the fallback query after the original query returned cero posts?

I just figured out why WP developers expect you to create a separate 404.php page to control the output of that page. (and the silence about any attempt to do it otherwise) It's basically because ...
0
votes
1answer
45 views

posts order by title second word

This is a common question, i haven't been able to find a straightforward answer to. I want to generate a list of a custom post type titles. im using 'orderby' => 'title' to have them display ...
0
votes
1answer
28 views

WP_Query create html structure

I have a page here to illustrate my question http://www.ttmt.org.uk. The first grid is hard coded using the html structure I want - div's to contain each row and then div's inside that to contain ...
1
vote
1answer
1k views

Wordpress Pagination Not Working - Always Showing First Pages Content

I am working on a website where I have a blog but I also have a custom post type to allow me to drop in some videos. I would like to use pagination so that if there are more then 9 videos displayed, ...
1
vote
1answer
1k views

Use WP_Query with have_posts()?

Is it possible to use $items = new WP_Query( $query_args ); with <?php if(have_posts()): ?> <?php while (have_posts()) : the_post(); ?> without changing the loop to be <?php ...
0
votes
1answer
32 views

Get the tax term in which is a post via wp_query

I'll rewrite my original question because I feel like I can't be understood : I made a template page on which I have different WP_Query. I have a category taxonomy (countries). This template page ...
0
votes
1answer
18 views

Custom wp_query - I'm getting 'all' post, not the specific post in the query

Get all post from today, that are of post type 'product' and are in the taxonomy of 'productType' as 'Indica' and in the taxonomy of 'locationCity' as 'Los Angeles' -- However, I get 'all' the post ...
0
votes
0answers
23 views

tax_query dynamic search

Sorry for my english, I'm french speaking I'm working on a web site. I have a taxonomy that can select a department and state for all the posts of the site for admin users and a page where there are ...
-1
votes
2answers
7k views

How to clear the cache?

I have made changes in my CSS, but it doesn't work. I know it's because of caching from admin panel. How to clear cache of my WP admin. Is there any method to clear the cache?
-1
votes
1answer
37 views

How to cache wp_query with pagination using transients?

I have seen examples where there is a fix number of posts to be queried; however, I cant find an example when using pagination. I am trying to figure out how to use transients to cache a WP_Query ...
0
votes
0answers
25 views

Search custom post type with multiple queries

I am looking for way to search custom post type with multiple queries. I need to run single query from user search and if that isnt resulting with single post result to use another query. If first ...
0
votes
1answer
719 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', ...
4
votes
2answers
2k views

How to use a custom post type archive as front page?

I'd like to use a custom post type archive as a site's front page, so that http://the_site.com/ is a custom post type archive displayed according to my archive-{post-type}.php file. Ideally I ...
1
vote
1answer
163 views

using wp_query to return posts w/ comment count > 0

I've looked at numerous examples of wp_query and can't figure this out. If the thing I was comparing were a meta value then I could to a meta query, but apparently you can't do a compare with a ...
0
votes
3answers
69 views

WP_Query fails despite having 1 post

I'm doing a typical custom post type query with args like this: array (size=4) 'post_type' => string 'custom_post_type' (length=15) 'post_status' => string 'publish' (length=7) ...
1
vote
1answer
59 views

How to exclude post formats from wordpress recent posts in a tabs widget

hey guys so i have a problem is that what i want is just standard recent posts only to show and i using a function in my the theme function file to show the recent post the code of the function ...
4
votes
1answer
96 views

How to uniquely identify queries?

Today I was thinking about how to differentiate queries, mainly to create an unique identifier. In the process I played around a bit, see below code. The main idea is to do it depending on the ...
1
vote
0answers
48 views

How to query custom post types with mixed AND & OR statements for custom fields

I have a custom post type "events" which includes the custom fields "is_premium" (which is a true/false) and "premium_expiry_date" which is a date picker. On my front end, I want to have "events" ...
2
votes
1answer
47 views

WP_Query and name__in

Is it possible to have something like name__in array() for WP_Query? I am trying to get a list of (custom) posts from an array of the post's slugs. Looking at ...
2
votes
1answer
58 views

Adding Post Counts to Menu (Nav) Programmatically?

I'm fairly stumped on this. Without getting too query-heavy, I was wondering what path one might take to produce a menu that links to a category of posts, and displays in parenthesis how many new ...
2
votes
1answer
103 views

How to stop wordpress to make the default query?

My goal is a redirect to a custom template based on some new rewrite rule, but without having wordpress to make unusefull queries. my code: function add_rewrite_rules() { add_rewrite_rule( ...
0
votes
1answer
29 views

Random loop with code to prevent duplicate output returns no output at all from time to time

I have a custom taxonomy with several quotes assigned to each term. Two terms (general and yoga) share the same pool of three quotes. On my front-page.php i randomly draw one quote from each term and ...
0
votes
0answers
24 views

Custom query from all posts & all child page from one parent page?

I'm working on a wordrpess site for improve search result. Now I want to fetch posts from a certain category & all child pages from one parent page. If I set post_parent => parent_id then ...
0
votes
2answers
1k views

Sort posts by custom taxonomy name

Is it possible to sort posts (custom post type) by category / taxonomy (name, desc)? For example my categories would be Season 2012 some post some post some post Season 2011 some post some ...
0
votes
0answers
46 views

Using WP_Query to get attachment returns empty set

I would like to get the first audio file in the media library filtered by a custom field, but it always returns an empty set of posts. I know that I have to pass 'post_status' => 'inherit' and ...
0
votes
2answers
288 views

Paginate pages with dynamic query

I have a wordpress page that has a series of listings and a searchbox at the top. The search allows the user to filter posts by creating a custom WP_Query object based on what they selected. I am ...
1
vote
1answer
34 views

WP query exclude post within the last month / only show over 1 month old

I need to create a landing page which only shows posts that are at least a month old. Everything I've read / tried with the date query so far seems aimed at including posts between the last month ...
0
votes
0answers
27 views

A Depth Like Parameter For “get_posts”

Wordpress has stumped me for the first time in a very long time. I am trying to limit the depth of a get_posts call in my template. I want to get children but limit it to a depth of only 3 as I am ...
0
votes
0answers
35 views

Filter Wordpress post Dynamically on dropdown selection?

Want to filter Wordpress post Dynamically on dropdown selection? But am not able to find out any solution how it can be done.Any help appreciated. Thanks On Clicking On Latest to Old the post ...
0
votes
2answers
34 views

posts_nav_link pulling in multiple post types

I have an archive-regularproducts.php set up that looks like so: PHP: <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> //content goes here <?php endwhile; ...
1
vote
3answers
54 views

Taxonomy and Date in same query?

Is is possible to combine a tax_query with a date_query in the most recent Wordpress? Here's my attempt to do so: $args = array( 'post_type' => 'job', 'tax_query' => array( array( ...
1
vote
1answer
4k views

Multiple WP_Query loops with Pagination

There are a few other questions about this (and WP_Query pagination seems to be a huge question for a lot of people) so I'm trying to narrow down exactly how to make it function. I'm able to create a ...
0
votes
2answers
139 views

Pagination not working on Custom Page Template

I searched a lot on this but I can't figure out why my code is not working. I published a page with slug "blog" that uses a custom built template "page-blog.php" that I build from editing the ...
0
votes
1answer
69 views

How do you move custom fields to custom taxonomies using WP Queries

To save complication I have imported a custom fields (categories & terms) to the wp_postmeta table, which are linked to respective posts. Shown as listed in wp_postmeta: meta_id post_id meta_key ...
0
votes
1answer
859 views

wp Query Posts to display in Nivo Slider

i have coded a slider into my wordpress theme to use query posts to display the thumbnail and the content however it appears that its displaying the whole posts? and not just the one relating to the ...
0
votes
1answer
36 views

How can I include sub-forum topics in a bbpress topic loop?

Out of the box, bbpress shows topics from a particular forum when you are on that forum's archive page. Makes sense. If that forum has a sub-forum, it will link to those sub-forums, but it won't show ...
0
votes
0answers
11 views

WP_Query using OR arguments e.g. posts in Category OR has Tag [duplicate]

I'm wondering if it's possible to use WP_Query() to filter posts by multiple OR arguments. I'd like to retrieve all posts that are in a category OR have a tag. If this is not possible using ...
0
votes
0answers
34 views

Query category-specific, paginated posts and allow viewer to change sort order

Maybe this has already been asked here, but I can't seem to find a solution, so forgive me if this is a duplicate. I have coded a custom template to display all posts from a category with the ID 36. ...
0
votes
1answer
54 views

List sibling pages widget, exclude current page

I successfully created a widget that displays sibling pages to the current page I'm on in the sidebar. Only thing is, I'm not capable of excluding the current page - can someone please assist here? ...
0
votes
1answer
100 views

Merged two WP_Queries, posts per page and pagination not working

I merged two WP_Queries with the code below, it has pagination setup as well as posts per page in the final combined object but those settings aren't working. My page shows 24 posts, where is it ...
0
votes
1answer
36 views

Need help setting up a search form for wordpress [duplicate]

I want to set up a search function as a widget in wordpress. This is the situation that I have. 1- I have 3 custom post types 1.a: Each post type has custom fields and taxonomies. I have regular ...
0
votes
2answers
334 views

How to use if($wp_query->query_vars['name'] == 'pagethatdontexist') without getting a 404? How to suppress 404

i want to do something if my url is /pagethatdontexist But I dont want wp sending 404 headers. I tried this: add_action('wp', array($this,'awp')); function awp(){ global $wp_query ; ...