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

Search tags in CPTs

I can't seem to figure out how to include tags in a wordpress search. For example, if I search for 'apple', I would like to get back posts with 'apple' in the title or the content (default wordpress ...
0
votes
1answer
21 views

Adding css tweak based on page template

I have a parent page that is listing out all of it's child pages. This is done using the below: <?php $query = new ...
1
vote
1answer
53 views

WP_query Date Range results not matching loop

I have written a WP_query with a date range. $args = array( 'date_query' => array( array( 'column' => 'post_date_gmt', ...
0
votes
1answer
31 views

Pagination returns 404 after page 20

I got a paged loop that pulls in 4 posts per page from custom post type. It works great, with the only downside that the pagination wont go over the page/20 everything after that is 404, and the ...
0
votes
0answers
12 views

Inject post into feed

We have a promo post, and if this promotional post is published, I want to inject it into every tag feed that meets our criteria. I figured it would be possible by modifying $query via $query->set(), ...
0
votes
1answer
26 views

Using WP_Query to re-query and sort results using a date?

I'm writing a function to find the users next upcoming event (stored as CPT), chronologically. If I use a normal query and do something like 'post_type' => 'ticket', // another CPT set up to act ...
0
votes
0answers
9 views

Show posts between two Custom Fields date

I'm trying to fetch all the posts from today to next week by using some custom fields inside posts, using Advanced Custom Fields. Everything was working until now, because it doesn't show posts from ...
1
vote
1answer
31 views

Minimising Database Queries when using Advanced Custom Fields

I'm working on a page which lists staff members for a large company and trying to minimise the number of times I'm forced to query the database as it gets quite complex and slow. 'person' is a ...
0
votes
3answers
29 views

Query & the_content() is showing in the header

This post is about two things: All the results of this query are posting to the header of the Page not on the content area as they should. Do you know of a solution as to why this is happening and ...
0
votes
2answers
16 views

Custom Plugin - Query CPT - Display Results

This code is going into a sample Plugin I am creating as a test using CPT and print them to a Page. I have been trying to get print_r() to give me an object. The custom post types are posting - ...
0
votes
0answers
7 views

Exclude posts by a guest author still making it accessible from direct url

How to exclude posts by a guest author from category, archive, search and tag pages but still accessible from direct url. I do not want to delete these posts, but is it possible that they are not ...
0
votes
0answers
16 views

Query posts from multiple post types sorted by overarching menu order

I have three different post types named activity, publication and project. I want all posts from these three post types to appear on one page on my website ordered by an overarching menu position. ...
0
votes
0answers
21 views

WordPress ignoring LIMIT / posts_per_page despite being in wp_query

Using WP query: $myquery = new WP_Query( array( 'posts_per_page' => $instance['count'], 'meta_key' => 'mywp_post_views_count', 'orderby' => 'meta_value_num', 'order' => ...
0
votes
1answer
17 views

How to extract information from a wp_query result?

Background: I'm using a wordpress theme called skt full width. I am modifying their front page slideshow, so that it displays six random images instead of six pre-selected images. I have a custom ...
0
votes
1answer
16 views

How to get to a specific position in wp_query?

Background: I'm trying to display images in a slideshow, and I want to select those pictures randomly from the website's media. The image has a custom field in order to be selected for being the ...
0
votes
0answers
30 views

Proper Array Setup

I'm having real trouble getting this to function right, basically I'm tweaking an array for the related products section of WooCommerce for WP, but it's not really a plugin issue more of a general ...
1
vote
1answer
44 views

Use 'parse_query' filter to show posts that from multiple criteria

I am trying to filter the Posts page in the WordPress admin to show posts that meet the criteria for "A" -or- the criteria for "B". I've scoured documentation and can't find a good way to do this. ...
0
votes
2answers
38 views

How to access $wp_query object from array of posts given by get_posts?

I have a simple custom query driven by get_posts: <ul> <?php $args = array('post_type' => 'event', 'numberposts' => 6 ); $myposts = get_posts( $args ); foreach( $myposts as $post ) : ...
0
votes
0answers
25 views

How can I display excerpts of my Recent posts on my static homepage?

I am using the openstrap theme. I want a static home page on my Wordpress website, I have already set this up and have a bit of content on it, the next step is I want to have atleast 4 most recent ...
0
votes
2answers
30 views

ACF accessing a field from the query, but not in post

I'm not sure if this is possible - but checking before re-writing the template. I've extended wp_query to allow for a geocode/location search to be performed. This is working in itself and returning ...
0
votes
1answer
22 views

Custom navigation : show posts in sets of 4

I am trying to reproduce an existing site design in wordPress. The site has a sidebar navigation that shows 4 posts at a time, see here: http://www.davidrich.net/david-rich-paintings/1-1 I you click ...
0
votes
0answers
23 views

Geo location query inside wp_query?

I am building a simple property search website using Wordpress. One of the requirements is for a search tool to search for properties available for sale / to rent based on number of bedrooms etc. ...
0
votes
1answer
15 views

List all Custom Post Type posts excluding certain Taxnomy term

I'm writing a theme in which I've registered "Services" as Custom Post Type that supports "Type of Service" Custom Taxonomy. I want to list all the posts of type "Services" except those which have ...
0
votes
0answers
13 views

No increments in counter in wp-query [on hold]

I am trying to show related posts outside loop on a single custom post type post in an ordered list. I am using the below code but somehow it does not increment the numbers. <?php ...
0
votes
0answers
21 views

WP_Query with meta_value_num and meta_query not paged correctly

I have a strange thing with my WP_Query, where isn't paged correctly. $args=array( 'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => $limit, // 10 ...
0
votes
0answers
17 views

Optimising specific Query with ACF meta objects

Is there any way I can improve the following query without touching the server, as it's taking around 5-6 seconds to execute, the SQL is outputing as: SELECT wp_posts.* FROM wp_posts INNER JOIN ...
0
votes
0answers
12 views

wp_query in form method of widget breaks customizer

In the "form" method of one of my widgets I make a query to offer the user some posts to choose from, like this: <?php $products = new WP_Query( array( 'post_type' => ...
0
votes
0answers
13 views

post by Category not working after setting 4 post per page

I am trying to show 4 posts on my homepage that is working fine but whenever i click on sidebar post categories it still shows the 4 post from homepage i.e the filter doesnot works and it shows 4 post ...
0
votes
1answer
21 views

Adding a block with query in homepage

i want my 2 post blocks to show by Categories not recent And not by category. <!-- Latest posts --> <div class="home-section"> <div class="container"> <div class="row"> ...
0
votes
1answer
34 views

Query posts by views on category page

I'm having trouble trying to create a second query on the category.php pages, what I'm trying to achieve is displaying the most popular posts from the current category archive page being viewed. ...
1
vote
1answer
62 views

WP_Query pagination not working in admin area

I've created a custom plugin page. On this page, I list posts using wp_query(). It works fine. I want to add pagination, but it doesn't work, even when I'm using the code provided within codex: ...
0
votes
1answer
17 views

Custom Taxonomy Query by Taxonomny not working

Not sure what's going on - here's a look at my code: $args = array( 'orderby' => 'title', 'show_posts' => '-1', 'posts_per_page' => '-1', 'cat' => $goalsCat->cat_ID, ...
0
votes
1answer
33 views

Function using get_posts() with tax_query not working when called from functions.php

I want to get an array of all the 'bands' in taxonomy 'types', and use the array later on in other functions etc. I have a utilities.php file that I require() in functions.php and it has the following ...
2
votes
2answers
109 views

Syntax to get the Nth item in a list of custom post types?

We have a custom post type testimonial and want to show the 1st, 2nd and 3rd in various bespoke locations on the page. Here's how we would do it if we just wanted to loop over testimonials and show ...
0
votes
0answers
7 views

Time difference error while publishing posts to word press via xmlrpc

I have a blog which i update content on the daily. in addition i have a system that pushes content(posts) to the blog via the WordPress xmlrpc file. My blog and the content pushing software are on ...
0
votes
0answers
20 views

WP_query returns 5 posts whereas 'Blog pages show at most' is set as 10

I have more than 10 posts (CPTs) on my site. The Blog pages show at most option is set as 10, yet the following returns no 10 but 5 results: $args = array( 'post_type' => 'my_CPT', ); ...
0
votes
1answer
39 views

wp_query if have posts show date but not in loop

I have a wp_query set up to show events and I want to show the date if we have posts and if we do not I do not want to show the date. Here is my code: <?php $today = getdate(); ...
0
votes
0answers
11 views

WP Query with multiple posts and meta queries

I have three custom post types: Stories, Venues and Cities. With Advanced Custom Fields I have added a related custom field to each post type. Each Story has a Venue ID and each Venue has a City ID. ...
0
votes
1answer
34 views

Featured image not showing on page

I am new to creating a theme and wonder if anyone can help? I am trying to display all the featured images from posts under a specific category (id=5) on my index page and it's not working using the ...
1
vote
1answer
37 views

Advanced Meta Query for Large Calendar Website (12k+ posts) (175k+ wp_postmeta rows)

The Problem On a site I built, I opted to use custom fields instead of a calendar plugin to organize my posts in a "calendar". In the beginning this seemed like the most logical way to accomplish ...
0
votes
1answer
29 views

pre_get_posts or $where, which one to use?

i have a custom search widget, that is searching only one custom post type that contain a meta_key that is greater than or equal to 1, in which i am gathering post_id. of all of those post_id(s), i ...
0
votes
0answers
24 views

Combining multiple query arguments into single query_var for permalinks

how Is it possible to combine multiple query arguments into a single query_var to be referenced in the permalink? For example, using the Posts 2 Posts plugin, it takes three query_vars to filter a ...
0
votes
0answers
13 views

Add filter to Orderby Parameter using Array

Using WP-Query, I'm setting the Orderby parameter using an array: $events_args = array( 'post_status' => 'publish', 'post_type' => 'events', 'meta_key' => 'start_time', ...
0
votes
0answers
9 views

I need value of saved meta to display next to the post it is associated with

This code goes on a category page. I display all the posts that belong to a specific category here, one after another. Each post has a meta box which has a drop down, so the user can select one of ...
0
votes
0answers
22 views

Custom Post 'Post Per Page’ Crashing Page?

Has anyone encountered this before? A normal page template with a custom post type query on it. However, when it gets to a set amount of posts the page crashes, white space below where the query sits ...
0
votes
1answer
16 views

What is the difference between these two custom queries?

Could you please explain what the difference is between the following two custom queries? $arguments = array ( 'post_type' => 'post', 'meta_key' => '_count-views_all', 'orderby' ...
0
votes
2answers
24 views

display news with pictures 3 small and one large (loop)

I'm trying to put 4 news with pictures 3 small and one large, have gotten displaying them but the "large" is repeated with the last "small" <?php $b=1; $args = array( ...
0
votes
1answer
9 views

Running a custom query inside another cpt single and trying to grab a variable

I made a cpt "Neighborhoods" for different neighborhoods. On the Neighborhoods archive, you click on one and go to the single. All good. an example url is /blog/neighborhoods/south-austin/ But I'm ...
0
votes
2answers
127 views

How to use the_posts_navigation for wp_query and get_posts?

WordPress have the_posts_navigation function since 4.1.0. But I don't know how to use with wp_query or get_posts. the following code is in a template file of page.wp_query method: <?php if ...
-1
votes
1answer
35 views

display custom post type from register taxonomy

I've created a custom post type via this function: function custom_post_type() { $labels = array( 'name' => _x( 'advertising type', 'Post Type General Name', ...