"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
2answers
16 views

wp query for popular post with simple field

I used simple-fields plugin for one addition field(premium posts) and now I need to change the popular post widget. I need to get all popular post exclude premium post. What I have tried so far, ...
0
votes
1answer
12 views

List posts of terms but exclude one term

I have a Custom Post Type for "Products" with a Custom Taxonomy of "Product Line." I've set up a page to list out the Products by their Product Line. However, we're also using a Product Line of ...
-1
votes
0answers
17 views

Query show/hide current post in archive page

I'm having lot of headache with that since a couple fo days . . . I explain my situation: I'd like to show/hide the_content on click of the_title of a post in my archive page. Righ now, it display . ...
0
votes
2answers
19 views

WP_Query loop else statement not executing

I have two WP_query loops in my frontpage.php file: <div id="aanbod"> <div class="container-fluid section-name-cont"> <div class="container"> <div class="row"> ...
0
votes
2answers
25 views

Add pagination to table generated by wp_query

I spent hours trying to find a solution to this, but I am not able to figure it out. I have a table that shows user's data and I am trying to add pagination to it. I have tried by adding "paged" in ...
1
vote
1answer
18 views

Complex WP_Query order request: DESC by day, but then ASC by time

I've got a site with a couple thousand time-stamped posts in a custom post type. These get displayed by a few taxonomies and a date query in various views (I've got that all working just fine ...
0
votes
1answer
25 views

Get the post thumbnail with wp_query

I am trying to get the post thumbnail to show in line with these other functions and am having no luck: Info: <?php echo '<h2><a href=\"' . get_permalink($attractions->post->ID) ...
0
votes
0answers
18 views

Woocommerce Ajax Pagination [on hold]

I am creating plugin for ajax pagination in woocommerce product archive pages. When i click page number navigation, ajax works but some classes for product list are not added hence product list does ...
0
votes
0answers
14 views

Order by custom field returns nothing [on hold]

im trying sort post by a custom field but i have no sucess: echo vp_metabox('meta_eventos.evento_data_start') Show one date, example: 16-03-2015 I need to sort posts by this date, im trying use: ...
0
votes
1answer
19 views

wordpress sorting using array merge by price in ascending order but price with 0 must be show last

I'm using below code to filter the query on page and sort the post in ascending order by price. I'm getting desire output but my concern is , i want all price with 0 at last. <?php global ...
-1
votes
0answers
16 views

Single template for posts outside of WordPress

I could really do with some help. I have a site that is currently flat HTML with a flat news section, I am turning the site in to PHP and integrating WordPress into just the news section, not the ...
0
votes
1answer
14 views

Using orderby with 2 meta keys

I can use orderby with one meta key in the WP_Query using following: 'orderby' => 'meta_value_num', 'meta_key' => 'my_key_1', However is it possible to use orderby based on the calculation ...
0
votes
1answer
22 views

Limit loop to future events

I have a custom post type, basic_events, with a custom date field, date_of_event. My view shows these posts in ascending order, based on this custom date field. $args = array( 'post_type' ...
1
vote
1answer
22 views

Searching user meta using WP_User_Query

Per the documentation for WP_User_Query, there is an available search parameter. It looks something like this: $users = new WP_User_Query(array( 'search' => 'This is my search' )); You can ...
0
votes
0answers
23 views

Modify shortcode to work with custom taxonomies and slugs

I am using this code which works fine with posts but I am looking to modify it so that the user can specify in the shortcode: custom post type name taxonomy name slug of taxonomy category For some ...
0
votes
0answers
37 views

SQL query equivalent to WP User Query

I have the following WP user query code: //Get all users sorted by whatever $sorted_users = new WP_User_Query(array( 'orderby' => 'meta_value', 'meta_key' => 'satisfaction_rating', ...
0
votes
1answer
16 views

WP_User_Query orderby meta_val_num

I know that normal WP_Query's can have an "orderby" parameter of "meta_value_num", but when I try to user "orderby" => "meta_value_num" on a WP_User_Query, it doesn't seem to work. Anyway I can ...
1
vote
2answers
40 views

Complex WP SQL Query

I have tried the following SQL query without any success. Can anybody that have a better understanding of SQL help? Here is what I am trying to achieve: Get a list of all main events (ME) where the ...
0
votes
2answers
31 views

Hiding carousel indicators if there's only one post

I am working on a custom carousel (Wordpress + Bootstrap). The carousel is working without problems. However, I would like to hide Bootstrap carousel indicators and arrows if there is only one post. ...
0
votes
1answer
30 views

How to show list of posts with custom field value (a date) that are coming soon

I have a custom post type called client and it has a custom field of next_due_date, that is a date without time. I want to have a list of posts that have a next due date that is coming up soon. I ...
0
votes
1answer
18 views

Query Taxonomy By Page Title

What I want to do is display posts that share a taxonomy on a page with that taxonomies name. For example, a page named "PHP" would display all the of posts with the custom taxonomy "language" set to ...
1
vote
0answers
16 views

tax_query OR with empty result returns all posts

I'm running a WP_Query with a tax_query with two tax_query statements with an OR relationship. $tax_query_terms = array( array('taxonomy' => 'post_tag', ...
0
votes
1answer
31 views

How can i see/log all requests coming from a registration form (not from the UI)?

I am talking about the REGISTER form PROBLEM: I have some requests that are coming from somewhere else - not from the user interface. I know this, because these requests don't have all the mandatory ...
0
votes
0answers
6 views

Multiple custom post query based on custom field values

Trying to get data from custom posts based on custom field keys and values. The below triggers when someone clicks on a month based item list. If Jan is clicked $id = 1, if Feb is clicked $id = 2 ...
0
votes
0answers
16 views

Show posts in category

I have a problem in the loop by the time I make a wp_query . What I'm trying to do : Bring only 4 random posts of the Videos category. Videos This category is the Post -Format Video type (I believe ...
0
votes
1answer
25 views

Custom query on custom table fails

I have a custom table in my Wordpress database and have a custom query that runs against it and displays the data in a custom template. This is the query $query =" SELECT * ...
0
votes
0answers
50 views

Get Current CPT taxonomy category in shortcode

I am calling my shortcode like this which works fine but I would like to avoid defining the slug, and instead picking it up automatically from the current custom post type that the shortcode resides ...
0
votes
0answers
26 views

Call to a member function have_posts() on a non-object [closed]

I have a WP_Query object that is trying to query sticky posts. I have one after the other in fact, one queries stickies and the second queries none-stickies. <?php /** Grab the sticky post ...
0
votes
1answer
25 views

All Posts Have The Same Comments

I'm getting a really weird bug. I'm getting the same comments from 1 specific post which is the "Hello world" for every single post! But when I remove a bit of code for a recent posts widget that I'm ...
0
votes
0answers
39 views

ACF Relationship Field Search Filtering

I am trying to assign relate posts using the ACF relationship field. It has typeahead search to search by post titles. I would like to add meta_data search to the ACF relationship search. This ...
1
vote
1answer
52 views

WP Query Args - Title or Meta Value

How do I query by meta_value or title? If I set meta_values, $args['meta_query'] = array( 'relation' => 'OR', array( 'key' => 'model_name', 'value' => $thesearch, ...
0
votes
1answer
13 views

Hiding all posts/products/pages from a site based on a custom taxonomy/domain name

I'm working on a site that's running Domain Theme Mapper (http://codecanyon.net/item/domain-and-theme-mapper) with WooCommerce to present two sites with two different child themes... that share a ...
0
votes
1answer
23 views

WP_Query search for whole words

I'm searching for science related terms. Here's what I need my query to do. If someone searches 'bio', they should not get results for terms 'biology' but they should for 'bio science'. I need the ...
0
votes
1answer
14 views

Is there any difference between below WP_Query code snippets?

Below code return the same results. Is it any difference between them and if it is then which one is better? code snippet 1: $args = array( 'post_type' => 'product', 'meta_key' => ...
0
votes
0answers
11 views

What's the easiest way to update one taxonomy term after searching for another connected with the same post?

What's the best or easiest way to: Write to one custom taxonomy term ("registereddonation") value when given another custom taxonomy term ("dbtoken") value which is connected with the same custom ...
0
votes
1answer
17 views

WPDB for post count on post

I figured out how to show the count of a custom post type on author.php . I am trying to display the stats on their custom post as well. The same query does not work. How can I show the amount of ...
0
votes
0answers
26 views

Get closest event where meta_key field is an array

I have a custom post type called "Event", which contains a repeatable date field _cmb2_date . I have a function which prints out posts: function post_style_6($args) { global $post; $the_query ...
0
votes
2answers
34 views

Get meta info related to current post

I'm trying to get the meta info by key rw_related_link for each post but my code is wrong since instead get the ones related to the current post I got the same in all post and that's wrong. This is ...
0
votes
2answers
70 views

Filter by custom taxonomy slug on a custom post type

I am displaying results from a custom post type ("works") and want to optionally filter by a custom taxonomy ("genre") if that is set (i.e. if the loop is on the custom taxonomy archive template). I ...
1
vote
1answer
41 views

How to order a post type with meta_value_num and if meta_value_num does not exist then order by date

I want to order a list of post on basis of ratings. I have used meta key "wp_ratings" for storing the rating value in wp_postmeta table. Now I want to sort all posts . If a post does not contains the ...
0
votes
1answer
21 views

add_query_arg to compare and display events from a certain date

I have archive-events.php file that sorts custom post type 'events' via WP_Query using custom field that is date formatted YYYYMMDD (20150215) like this: $args = array( 'post_type' => ...
0
votes
1answer
25 views

Order by three custom fields (Y-m-d), then separate into yearly sections

For a project of mine I have set up three custom fields (Year, month, day) attached to posts in order to determine the original date of a post’s content (not the post publish date, which is used for ...
0
votes
0answers
15 views

Adding a Theme Customizer Control for Posts_Per_Page

I am trying to add a Theme Customizer Control to change the number of posts shown in my WP_Query posts_per_page, like so... <?php $posts_per_page_option = get_option( 'posts_per_page_option' ); ...
0
votes
2answers
66 views

WP_query is not returning the expected result

I have 2 dropdown lists, when a user select value in the first list, there is an ajax call to a function using WP_query which send results to populate the second dropdown. My WP_query is not ...
0
votes
0answers
20 views

how to get post by metabox in wp_query

I want to WP_query by tag_id but i need to insert tag_id by metabox i cant do it and give wrong any one help me? $value = get_post_meta( $post->ID, '_my_meta_value_key', true ); <?php ...
0
votes
1answer
23 views

Trying to get property of non-object in: $wp_query

I've this function at functions.php file: function custom_secondary_nav( $menu_name, $id = '', $menu_title = '' ) { global $wp_query; // others stuff goes here if ...
1
vote
1answer
58 views

How to prevent writing duplicate loops?

So i have some pages where i want to show my custom post type 'events' only by the last 5 posts (secondary query: WP_Query object) and some pages where i want to show all posts (for instance archive ...
0
votes
0answers
29 views

wp_query - Modify $query to include duplicate content

I'm setting some featured content through the customizer (it's saved in theme_mod); Using the pre_get_posts hook, I'm retireving the feature pages in this way: ...
0
votes
1answer
33 views

Can't get the_content to show

I'm using the following code to get posts from a category in a page. This category uses ACF for some fields. However, when I try to output everything, it shows everything but the_content. For better ...
0
votes
3answers
26 views

Filter out a meta key in the Search results page with two CPT

I have two CPT: Listings and Events. In Events I have custom fields for the start and end dates. What I need is a way to filter out any events that are past the current date. What I have right now ...