"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
12 views

How to orderby meta_value_num with dollar ($) sign

The custom fields all have prices including $ signs, and a dot as separator. $theQuery = new WP_Query(array( 'orderby' => 'meta_value_num', 'meta_key' => 'price', 'order' => ASC )); All ...
0
votes
1answer
227 views

Pagination on with query_posts in custom post type template

I know there about a thousand pagination issue questions on here, and I've looked at them, but I can't seem to figure out what's going wrong with mine. This is a loop on a custom post type archive ...
0
votes
1answer
294 views

WP_Query Pagination on multiple-loop page breaks WP or doesn't show up

The loop below is one of several on a Custom Page template, but it's the only loop that I'm trying to implement Pagination with. Once I have Pagination working for this one loop, I'll be implementing ...
0
votes
1answer
6 views

Custom Search Query – include only custom fields and title

I have a custom post type and I also need a custom search. I want the post title and two custom fields to be indexed/queried. I found solutions for title only and for custom fields but not for both so ...
2
votes
1answer
35 views

Including only current user's posts in search

I am a new WP plugin developer. I want the search page to include only the current user's posts. I first added a new capability read_others_posts to only administrators and editors. Then I tried the ...
1
vote
1answer
328 views

How do I create my own nested meta_query using posts_where / posts_join?

Some of my posts (not all) have a price as a meta key/value. Today I use the pre_get_posts action so that my users can search for prices that are between a certain value. This is the code that I'm ...
0
votes
2answers
730 views

Prevent pre_get_posts filter on specific post type

I am running into one issue with pre_get_post filter. Actually I have 4 post types. Post, Pages, Events, and Venue. I created one custom field called city for event and venue post type. When ...
2
votes
2answers
29 views

Display posts the match taxonomy term linked from wp_list_categoies?

This should be simple, but it escapes me. I have a custom post type and a custom taxonomy. The taxonomy is named "asset_type" and the slug is "type" I am using wp_list_categories to provide a ...
0
votes
1answer
30 views

list posts of two post types in a single template

I have two post types. One is post & other one is event. Both sharing same categories & tags. I am listing the posts by archive.php. Now I am listing the posts as general by two different ...
0
votes
0answers
14 views

Pagination on front page posts (custom query) stopped working after installing s2Member [on hold]

I am using the following code to set the pagination for both the custom and main queries on my site. It has been working fine until I installed s2Member. Now, the problem is that only on the front ...
1
vote
1answer
305 views

Can you order posts from wp_query by two custom meta fields?

I'm working on a site that lists events. Right now this query lists events by date: $args = array( 'post_type' => 'espresso_event', 'post_status' => ...
0
votes
2answers
394 views

Loop to fetch 3 post_thumbnail instances from 3 most recent custom post types named “portfolio”

I am trying to display 3 post_thumbnails from a custom post type "portfolio" on my homepage template. So one from post 'A' , one from post 'B' and one from post 'C' The image from post A will be set ...
0
votes
2answers
32 views

How do I order pages and categories by ID or name in the same query?

I would like to query most of my pages and categories on the homepage. So far I am able to get the pages and category (posts), but I cannot order the list the way I want to. I want to be able to get a ...
0
votes
1answer
324 views

Query multiple meta values

I'm working on a 'checkbox filter' to query posts by checked values. See this link (EDIT: As you can see there are just 2 posts in this link, as soon as the user checks for 'MINI' it gets a good ...
1
vote
2answers
326 views

Pagination problem after WP_Query with tag filtering

I have a problem with a custom WP_Query. I want a page with all posts with a specific tag. This is the code I'm using: <?php //save old query $temp = $wp_query; //clear $wp_query; $wp_query= ...
2
votes
1answer
82 views

How can I reduce the number of database query calls for this custom homepage?

I am working on the design of a blog with the below(just a sample) category hierarchy. PARENT | ...
0
votes
1answer
21 views

Using get_posts structure for a specific field [on hold]

Situation I have a custom post type named Packs and another custom post type named Hotels. In the Hotels CPT I publish hotels information, like name, amenities and services for many hotels in the ...
0
votes
1answer
23 views

Woocommerce query all products and categories

I need to generate xml file from all my products. My current query shows all product names, but how to access categories for each products? All the products have categories and subcategories. My ...
0
votes
2answers
58 views

WP_Query issues with argument posts_per_page

I have a query that displays the names of donors as well as a dedication. It displays using a date meta query. $args = array( 'post_type' => 'donors', 'order_by' => 'id', 'order' => ...
1
vote
2answers
48 views

Query that loads a custom type AND posts whose ids are not inside those custom types custom fields

On my news website I have posts and another custom type called "aggregato". This type has 10 custom fields, "link01", "link02"... "link10". Both posts and aggregato has a meta key, called "home", ...
0
votes
0answers
13 views

How to get specific records from table using multiple parameter

Bellow is my table structure wp_woocommerce_order_itemmeta meta_id order_item_id meta_key VALUE 1 2 Dining Date 2014-10-22 2 2 Booking Time 3:00 ...
-1
votes
0answers
15 views

Compare a value between to dates

I have the following query: $today = new DateTime(); $minDate = strtotime( '-1 day', $today ); $maxDate = strtotime( '+10 years', $today ); $args = array( 'post_type' => 'kalender', ...
0
votes
0answers
28 views

Sorting meta_value as integer doesn't work

This plugin uses the below chunk of code to print the top 10 highscores. But this doesn't get the list of top 10 scores sorted by meta_value in my WP install $scoreboard = new WP_User_Query( array( ...
0
votes
1answer
14 views

localizing variable on front-page.php template fails but succeeds on single page and taxonomy archive

I have the following code in a php include file: function pass_the_var() { $video_embed_code = jkaw_oembed_code(); return array( 'embedCode' => $video_embed_code ); } ...
2
votes
1answer
581 views

WP_Query() show posts that end later than today

I have a query as follows: $wp_query = new WP_Query( 'meta_key' => 'end_date', 'meta_value' => 'today', 'meta_compare' => '>=', 'post_type' => 'vehicle' ); ...
2
votes
2answers
1k views

Check for featured image in WP_Query

Is there a way to filter posts by featured image when initialising a WP_Query object? Example $my_query = WP_Query(array("has_thumbnail"=>true)); or, more ideally $my_query = ...
0
votes
0answers
8 views

all in one event calendar recurring event display event start time and duration [on hold]

I have been stuck on this for a while, I have written a custom query for using this example All-in-One Event Calendar: Custom Query - Getting each event Instance I am however having a problem with ...
0
votes
0answers
24 views

Comments pagination and WP_QUERY

I have a list of posts using wp_query On each post theres a list of comments What Im trying to do is to limit the number of comments to 2 and display a link for the next page of comments which I'm ...
0
votes
0answers
39 views

How to write select query to fetch multiple meta key and meta value rcord from table [on hold]

Working on table booking project. Bellow is the table sample wp_woocommerce_order_itemmeta meta_key meta_value Dining Date 2014-07-21 Booking Time 3:00 - 5:00 Here is my query ...
-1
votes
0answers
913 views

Query custom taxonomy term to display child terms & posts associated with term but exclude parent term

I've created a custom page-template to pull a custom post types (education) custom taxonomy (animals). What I'm trying to do is display all child posts + term (set as h2) inside the term ...
0
votes
0answers
21 views

Fire query on ajax post url page

Here i am sending the ajax response to load_post.php page from my ajax call.I am getting response on load_post.php on load_post.php i have to fire word press query. I was try this but getting bellow ...
1
vote
5answers
1k views

WP_Query returns no results

I'm using wp_query to create a custom query that retrieves search results but it is returning 0 results. Here is the code: $query = 's=the&posts_per_page=5&paged=1'; $custom_query = new ...
0
votes
1answer
294 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 ...
-1
votes
5answers
7k views

Get all categories and posts in those categories

I am looking for a solution that allows me to print the following: Cat 1 Cat 2 Cat 3 Post 1 Post 1 Post 1 Post 2 Post 2 Post 2 Post 3 Post ...
0
votes
1answer
240 views

posts_per_page is not working

I have a query to display custom post type categories' posts, but I want to limit the posts_per_page to 8, so I am using the code below. Please tell me, if I'm doing something wrong. <?php $args ...
1
vote
1answer
841 views

search query within custom taxonomy term, post title and meta field

I want to create a search that does: Search within my custom taxonomy - custom-tags search the post title search select meta field ?? dont know search with custom post type - easy part I looked ...
0
votes
2answers
609 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, ...
0
votes
0answers
24 views

How to organize a WP_Query's list of posts by category and display category title?

If I run a query with some args and get a list of posts, how can I organize the posts separated by category and display the title of each category? $array_out = array(); $args = array( 'orderby' ...
0
votes
1answer
27 views

Remove duplicated values from a loop

I have a loop that outputs <option> fields for a <select> group. It contains many cities' names for many travel packs that I am publishing. The trick is that I need avoid repeated values. ...
0
votes
1answer
379 views

Multiple keyword search

I have a custom search where I want to enter a keyword or phrase into the search box, and then by pressing enter it adds it to a 'search storage' (already coded, see below). Asume I have 3 posts, one ...
0
votes
1answer
425 views

Fatal error: Allowed memory size exhausted

I have a custom .csv generator functions that basically export data from posts and its post metas. The function works fine on this WP_query parameter: Array( [tax_query] => Array ( ...
0
votes
1answer
21 views

$wp_query when new WP_Query

I'm trying something but I have an issue with WP_Query. I've an Hook on the_post in order to add some variation on the query. add_filter('the_posts', 'query_variation'); function ...
3
votes
1answer
447 views

WP_Query ignores post_type in category view

I have following query to select posts by my custom post-type. This works fine while being on the frontpage (the snippet is included in the sidebar). As soon it gets executed on a category page the ...
0
votes
1answer
278 views

offset WP_Query by negative 1

I have an event loop and I was wondering if it's possible to somehow offset the loop by -1 so the prev and next posts of the current post are shown. --edit-- Okay thanks for your comments, my ...
0
votes
0answers
20 views

Get a list of the last posts grouped by author and filtered by category

i need a list of the latest post published by various authors, but filtered by category, like for example the latest posts of author that write about music. i wrote this query and looks like working ...
1
vote
2answers
68 views

Determine WP_Query parameters from URL

I'm wondering if it's possible to determine WP_Query parameters by only using the given page URL. The reason I'm trying to do this because I'm developing a SPA theme (and ultimately a JSON response) ...
0
votes
2answers
655 views

wp-query Shortcode in Gravity Forms Notification

I have the following code that runs two wp-query loops upon form submission to display specific posts depending on the users choices in the form (The form fields are radio buttons with values that ...
0
votes
1answer
20 views

Loop through categories and create tab for each

I'm trying to create a page that holds all categories of my custom post type as tabs, with a tab content. I am able to display all the category names as tabs, but i need to run a query in each tab ...
0
votes
1answer
27 views

Sticky posts are not showing at the top of category posts

Can anyone tell me why sticky posts are not being displayed at the top of the following query: $wp_query = new WP_Query(array( 'post_type' => 'post', 'posts_per_page'=>10, ...
0
votes
1answer
35 views

WP_Query order result by date AND meta_value

I have searched but not found an answer to my problem. I have posts with a meta key used for ordering. I want to order post by this value. If they have same value I want them to be ordered by date. I ...