"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
0answers
7 views

Filter meta data for simple and variable products on custom query

I have a custom query loop on a page using WP_Query and I want to filter by certain meta keys _price, _weight, _width, _height, _length, total_sales. I am able to get this working with both simple ...
0
votes
0answers
5 views

Combine WP_Query results with new WPDB->get_results Query

Is it possible to combine results from a WP_Query array with results from a new WPDB get_results() and use the loop to loop through the results? Essentially, I am trying to modify a shortcode that ...
0
votes
1answer
13 views

Accessing GET variable named 'error'

As part of a project I'm required to make a wordpress plugin which integrates with Google for authentication (There are good reasons for developing a new plugin instead of using an existing one). If ...
0
votes
1answer
13 views

WP_Query function for custom post type

I've got a CPT for random homepage banner images (so we can test different images and call to action language). I've got a custom field for the post type that accepts a specific ID for each banner so ...
0
votes
2answers
24 views

How to display specific ids of posts using wp_query?

I have 7 services in a page. All 7 services have featured images. I want to show all the 7 images and content in a slideshow. $args = array( 'post_type' => 'page', 'post__in' => ...
0
votes
0answers
23 views

How to Add Meta Values in Loop?

I am using a category page to list various businesses on a website. These businesses have reviews attached to them through posts that contain their unique tag. I want these aggregated rating reviews ...
0
votes
0answers
16 views

Sort using custom fields when empty [on hold]

I have the following problem: I am working with WordPress to create a homepage for a client, now I am at a specific problem, that there are custom fields and the posts need to be sorted using those ...
0
votes
0answers
10 views

Is it possible to combine multiple category__in arguments?

I want to produce a query that returns posts which are in one array of categories and also in another array of categories. So, if my two arrays are: $offices = Array ( [0] => 73 [1] => 74 ) ...
0
votes
0answers
20 views

Override default posts per page in taxonomy template

I am using the following code to show ordered list of posts in taxonomy page: <?php $mypage = (get_query_var('paged')) ? get_query_var('paged') : 1; $ppp = get_query_var('posts_per_page'); ...
0
votes
0answers
17 views

WP_Query and Pagination on a Static front page (Extending Visual Composer…)

For the past two days I've been trying to debug an issue with WP_Query() and Pagination. This website I'm a dev for uses a Wordpress theme (Salient by ThemeNectar) that includes the visual composer ...
0
votes
0answers
14 views

Ordering by custom post meta key

I'm using the plugin WP Job Manager, and have a custom field with the meta_key "rating". I want to be able to order listings by rating, using "orderby". Normally for posts I imagine it would be ...
0
votes
1answer
12 views

Filter custom post type by custom taxomony

I have several custom post types, each with one or more custom taxonomies. I'd like to add a filter for each taxonomy to the relevant custom post type edit screen, but my solution is not working. ...
4
votes
3answers
138 views

Better way to get tag stats?

I have over 4000 posts. I am trying to query all the posts and get the count of tags each post has and sum up posts count based on number of tags the post has in dashboard. The posts count shows up ...
1
vote
1answer
46 views

List only posts from specific category on category page

I wanted to ask if there is a shorter way then by checking each time if the post is coming from a specific category. As you can see the categories cover the alphabet, A B C etc and each time I check ...
0
votes
3answers
26 views

get_posts with multiple categories

If I do a get_posts() with category set to 1,2 I will get all posts in category 1 OR 2. If i want all posts whit both categories, that is 1 AND 2, how do I make that request?
0
votes
2answers
30 views

current_post not working - give me -1 for every post

I try to get the current post index number and echo the number of this lesson(post)in a series of lessons(category). I'm inside the loop on single.php page my code looks like this: $args = array( ...
3
votes
0answers
24 views

How to add taxonomy filter on the query fly?

I try to add tax query on pre_get_posts hook using following code : // Add custom posts to main query (archive and home) add_action( 'pre_get_posts', 'add_post_types_to_query' ); function ...
1
vote
1answer
54 views

How get posts from a subcategory of a category by name?

I'm trying to create a subcategory template of a defined category. For example, for each one, I would like to check if his subcategory Photos exists and to get posts of this. Here is my category ...
0
votes
1answer
20 views

Get posts associated with custom taxonomy alternate way

I have a custom post type named artwork and I'm trying to get all of the artwork that is associated to the custom taxonomy of artists on the taxonomy-artists.php page. I found an example here which ...
3
votes
1answer
33 views

WP_Comment_Query pagination, delving into the unknown

I am aiming to pagination WP_Comment_Query(). It appears this is either taboo or there is no viable information about it online, not anything. Why? Is it possible? If so, how?
0
votes
1answer
22 views

How to convert query sql to shortcode in wordpress?

I want to make a shortcode like this [myshorcode:2:drinks], and query-wrangler I have managed to get the following query that shows me 2 products of a certain taxonomy PHP WP_Query: $query = array ( ...
0
votes
0answers
5 views

Paginate Multisite Attachment WP_Query

I am working on a multisite blog network where I need to display x post per page and navigation at the of the bottom list. My code will not display a pagination at the bottom and displays x post per ...
0
votes
1answer
40 views

Display post list within category list sorted by name [duplicate]

I'm trying to display a list of categories sorted by name and all posts of each category inside it. Like this: Category A Post B Post F Post Z Category B Post A Post C Post G Category C Post D ...
-1
votes
0answers
12 views

Show all subcategories post on parent cat page using wp_query

I am trying to display the children categories post. $wp_query = new WP_Query(); $wp_query->query('post_type=post&posts_per_page=12&paged='.$paged.'&category__and='.$cat_id); <?php ...
0
votes
1answer
19 views

problems with comments_number()

Why does the following code: echo '<ul>'; while ( $query->have_posts() ) { $query->the_post(); $title = get_the_title(); echo '<li>' . $title . comments_number() . ...
0
votes
1answer
10 views

Issue attempting a wp_query_posts with tags

Having an issue trying to query the most recent posts using the tag, in this case, trending. I used the following code but I get no results. If I switch out 'tag' to 'post_type' it will work: ...
0
votes
1answer
52 views

Taxonomy search/filter with multiple taxonomies and multiple taxonomy terms

I am trying to build an advanced search form that allows users to select from two taxonomy based drop down menus. Each taxonomy drop down has taxonomy terms from which the user can select multiple ...
0
votes
1answer
37 views

Add banner after the third post [closed]

How do I add a banner or a DIV with content after the third post on the index or category of Wordpress 4.0? // Start the Loop. while ( have_posts() ) : the_post(); ...
-1
votes
1answer
29 views

tax_query not working properly with get_posts

Here are my args: $args_home = array( 'post_type' => array('news', 'jobs'), 'posts_per_page' => 12, 'meta_query' => array( array( 'key' => '_thumbnail_id' ...
0
votes
0answers
14 views

How to create a collection of terms used by posts from wp_query

I am creating a custom search results page that has a WP_Query that looks like this: $args = array( 'post_type' => 'manuals', 'posts_per_page' => -1, 's' => ...
0
votes
1answer
31 views

Sorting Posts by custom field

I'm trying to sort my posts by the custom field artwork_title. When I use the following code, I just end up with one particular category of posts no matter what category archive I'm on. Also ...
0
votes
0answers
27 views

Are there security issues with Visual Composer add ons?

I am developing some add ons for Visual Composer. They are quite client specific so I am not planning to submit the plugin to VC as official add on suggestion. I used this bitbucket code to start ...
0
votes
0answers
22 views

Wordpress WP_Query offset parameter not working with search parameter

On a wordpress query every time i add the 's' parameter the 'offset' and 'posts_per_page' will not work, it will query all posts by using the 's' parameter only, why is that? am I missing something? ...
0
votes
1answer
38 views

Using page slug in wp_query

I'm currently in the process of building out a site for a legal firm that's a client of ours. We have a two custom post types, attorney's and cases, that we need to link together in various areas ...
0
votes
0answers
16 views

Pass tax_query variables in URL

I'm trying to create some URLs rewrite for my site, but now I'm stuck. I have this structure in my permalinks: example.com/%custom-type%/%category%/%postname% The full URL is already working: ...
0
votes
1answer
16 views

Query post Pagination Problem

I am using following code for query post but I am not getting pagination link. Where is the problem of the following code. <div id="primary" class="content-area"> <main id="main" ...
-1
votes
1answer
28 views

Randomly display posts on a site hosted by WPEngine? [closed]

I'm aware that WPEngine will allow you to enable the "Allow ORDER BY RAND()" setting in the dashboard but I need to find an alternative method to avoid performance issues. I have a custom post type ...
1
vote
1answer
40 views

meta_query 'compare' => 'IN' not working

First of all, I know it's a duplicate. But, I could find those older answers helpful. I'm searching in posts through post_meta. Here's My Code: $args = array( 'numberposts' => -1, ...
0
votes
1answer
17 views

Set Transient on CPT

When I add set_transient code to my cpt query, I get a Fatal error: Call to a member function have_posts() on string ... on line 30 Line 30 is basically: if($graduate_student_query->have_posts()) ...
0
votes
0answers
13 views

Query of all pages, including children, ordered by meta key

I'm saving a revised date as meta_value on every page and I want to display them ordered by the date in a list in my plugin screen. How to both include child pages (can be 4-6 levels deep) in the ...
0
votes
1answer
26 views

Why wp_query return 1 row if i have 3 row pass in it

I have this query to return the post $sitens = new wp_query( array ( 'post_type' => 'post' , 'post__in' => array($post_id) ) ); if ( $sitens->have_posts() ) : while ( ...
-1
votes
0answers
11 views

How to retrieve metadata from a term in custom taxonomy

I'd like to get a meta value of a meta field from terms in a custom taxonomy. I started with retrieving all terms: $customTerms = get_terms('ss_category'); Each term from ss_category has multiple ...
-1
votes
1answer
22 views

Query custom post types by meta field in a term from custom taxonomy

I need to retrieve all custom posts that have terms from custom taxonomy assigned to them. To be more precise: There is advertisers_cats post type that has terms assigned from custom taxonomy ...
0
votes
0answers
21 views

How to pass taxonomy terms to WP_Query along with $args?

I created a cpt and custom taxonomy associated with it. Lets say custom taxonomy name is Sports. I added terms to it - football, basketball. Now, i want to fetch post titles tagged under football ...
0
votes
0answers
11 views

Child pages of child pages

I am having problem listing child pages of my sub pages. Here is my code <?php // Set up the objects needed $id = get_the_ID(); $args = array( 'post_type' => 'page', ...
1
vote
1answer
27 views

Get the next event using date_query

I created a CPT called event and want to make a query to show the next future event, based on it's publish date. Here is the WP_Query args: $today = getdate(); $args = array( 'post_status' => ...
0
votes
1answer
32 views

Finding the next 5 posts

On my single.php where I am calling my post I am wanting to run a query where I can catch the next 5 posts (chronologically). I know how to do everything except figure out a way to specify the 5 ...
0
votes
1answer
30 views

Most popular post for last 7 days

I need to change the most popular post widgets with date restrictions. For an example, how should I get most popular posts(post_views_count) of last 7 days. original query, $popularposts = new ...
0
votes
0answers
35 views

order posts with conditions & meta_key merge

i want a code to orders my blog posts using a "conditions" & combinaisons of 2 meta_key so details: if ( postviews < 20 views in exmple) ==> those posts order with date ==> here ...
1
vote
1answer
36 views

How to get a category in a list item class

I am need to know how would I get the category to be dynamically input in a WP_Query This is the code I am using: <li class="<?php the_category(' ')?>"> but the output is breaking. ...