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

Get archive of posts separated by taxonomies and subtaxonomies

I'm making a website that lists hotels by region and sub-regions. I made a custom post type called Hotels and a custom Taxonomy called Regions. I've inserted countries as parent regions and states as ...
1
vote
1answer
25 views

Display posts with date wordpress default

I'm trying to display last posts with WordPress date, not date from server. <?php $week = date( 'W' ); $year = date( 'Y' ); $query = new WP_Query( 'year=' . $year . '&w=' . $week ); while ( ...
1
vote
1answer
14 views

paging in WP_Query on static page

I have a static page, and on that page I want to show a listing of blog posts. I want 12 posts per page (so I want the listing to be paginated). It's all working great, except for the pagination. ...
0
votes
1answer
17 views

Set div columns in a loop by post count

I'm trying to post images from a custom post type into columns based on the amount of posts that are returned in the loop. This is my code: <?php // args $args = array( 'numberposts' ...
0
votes
1answer
14 views

Secondary loop pagination on custom post type single post gets redirected to first page

I would like to output related posts on a custom post-type single page. Everything seems to be set up correctly. When I hover over my pagination links I see ...
0
votes
1answer
14 views

Get array of current post term ID's

I'm creating a little "Related posts" section on a site and I'm doing it based on terms in a custom taxonomy called "director". How can I get an array of term ID's for the current post so that I can ...
0
votes
0answers
9 views

query var “p” empty on some requests | custom rewrite rules

I am moving a site from drupal to WordPress. The "nodes" on drupal have custom "permalinks" that don't follow any rules so I have added the permalinks as post meta and create a rewrite rule for every ...
0
votes
1answer
18 views

WP_Query always returning the last custom post

I have code that works fine on our live system, and I'm porting it to a new theme. In the new theme, the WP_Query always seems to return the last custom post. My function is: function ...
-1
votes
1answer
24 views

Show Title/Date/Excerpt of first post & only Title for rest in Query [duplicate]

I need to show 7 posts of a certain category. The first needs to appear as Title / Date / Excerpt. While the others can just be Titles of the posts. Right now I am having trouble with getting the ...
1
vote
1answer
31 views

How would I format a query that depends on post parent taxonomy

I'm trying to do a custom query which is outside the scope of a single WP_Query, I think I should be using $wpdb but my SQL is a bit ropey. Also I only need the post IDs returned not post objects. ...
0
votes
0answers
28 views

Woocommerce sort by rating [on hold]

I'm using Storefront to develop my site and i need to sort the products by rating at a specific part (using WP_Query). I tried without success the following code in my $args: $args = array( ...
0
votes
0answers
32 views

What method does this eventually call: do_action_ref_array( 'parse_query', array( &$this ) );

I'm looking at this line of code at the end of public function parse_query in query.php: do_action_ref_array( 'parse_query', array( &$this ) ); Does this simply end up calling the parse_query ...
0
votes
1answer
36 views

is_404() - where does this get set?

Where does is_404() get set? Looking at the source in query.php: function is_404() { global $wp_query; if ( ! isset( $wp_query ) ) { _doing_it_wrong( __FUNCTION__, __( 'Conditional ...
0
votes
1answer
11 views

How to restrict search on a certain page to only return results against custom taxonomies?

On a specific page, I would like the search to be performed only against the terms from two custom taxonomies. Not the content or title. That is, the user is directly searching taxonomy terms. What ...
0
votes
0answers
11 views

Single query using Tags(Priority) and Category(Backfill)

I'm working on a widget that I would like to be populated by (a) the same category as the current post and (b) any post found to have a specific tag. So The query would return 10 results always, but ...
0
votes
2answers
21 views

Display Post co-authored in Author Page

I am using co-author plus and I have posts in my site that are done by multiple authors. I would like that when I click on the co-author's author page, I will be able to get the posts that he/she ...
0
votes
0answers
7 views

I want to show a list of all the custom taxonomies, and under each a list of some posts that match that

Does anyone know how they might do that? I imagine it would involve getting the list taxonomies, and then iterating through them with php to, and for each taxonomy item, querying the posts and ...
0
votes
0answers
9 views

Category page that displays 3 posts from each subcategory

Alright, so my main menu I am adding category "MainCat" that has subcategories i.e "SubCatOne" "SubCatTwo" etc.. When I click on that page I see all posts from all categories on it, unorganised (below ...
0
votes
1answer
24 views

WP_query issue with no posts

I am using form for my archive page so user can specify which posts they want to see and how they want to see them. I have it setup so they can choose ascending or descending order, posts per page ...
0
votes
0answers
27 views

How to display 20 posts by categories in custom sorted order and by post tile

I need to display 20 posts by categories that have custom sort order and orderby post title. Category (VW) order 1 - Beetle - Golf - Jetta - Toureg Category (Honda) Order 2 - Civic - Odyssey - Pilot ...
0
votes
1answer
15 views

WP_Query secondary query failing

I'm needing a couple queries on front-page.php and am at a loss why this is not working. My first query works fine, however, my second one specifying the category (or even nothing at all) never ...
0
votes
2answers
29 views

Get Posts that are in the current month or later

I have a custom post type that is an Event. I'm trying to query those Events and only return Events that are in the current month or later. So the event could be in the past, but it has to be in the ...
0
votes
0answers
11 views

Events calendar custom order issue

I've been trying to figure this out for several hours now and I just can't find a solution, so, I am new to WP. We are using the Events Calendar plugin, and in the calendar view they want to be able ...
0
votes
0answers
6 views

How to use custom_query_var along with post_id for comments

I have introduced a custom_query_variable - brand in my permalink using the below function. function add_query_vars_filter( $vars ){ $vars[] = "brand"; return $vars; } add_filter( 'query_vars', ...
0
votes
1answer
22 views

BuddyPress activity on edit post for a CPT

I have a Custom Post Type classified I figured out how to record an activity in the BuddyPress activity stream whenever a new post of type classified is created. What I am specifically looking to do ...
0
votes
1answer
21 views

Why does get_posts only show results for Admins or logged-out users?

I use a get_posts() call with these arguments: array(6) { ["include"]=> string(14) "1633,1634,1635" ["post_status"]=> string(3) "any" ["post_type"]=> string(10) "attachment" ...
0
votes
1answer
26 views

Can't seem to filter wp_query by current category ID

I'm querying a custom post type ("donor") and would like to list them grouped by category (a custom taxonomy for this post type), with the category title then all posts for that category. After much ...
0
votes
0answers
34 views

Wordpress ajax load more returns duplicated posts

I'm trying to load more posts from my custom post type via ajax call, it sounds like i'm doing everything alright but one thing which is causing the duplication issue. My load more button does work ...
0
votes
1answer
27 views

why custom post archive gives always no more than 10 posts despite of paging settings?

I've got a strange problem. I'm programming a custom post archive page. I'm using wp conventions, so I've got a 'project' custom post type and an archive-project.php page, which is correctly showing ...
0
votes
1answer
45 views

WP User Query get all authors with last name starting with specific letter

I need to program a page to which I pass an initial through the url and it will show all author users whose last name starts with that letter. I would like to do this via WP User Query so that I can ...
1
vote
1answer
24 views

how to filter by last name for custom post

I have a custom post type (speaker) and I would like to load the list of speakers sorted by last name. I can't seem to figure it out. I tried the code from this post: ...
0
votes
1answer
16 views

Custom post type not being pulled in widget

I am creating a widget that displays data from my post type 'testimonials'. The back end of the widget is working fine and displays a list of testimonials and allows me to select which I want to ...
0
votes
1answer
75 views

woocommerce - How to query Popular Products and Featured products in same loop [on hold]

I'm trying to query for best selling products (popular) and featured products using one loop. And, potentially being able to add an identifier to each product –as a class– to be able to filter them. ...
-1
votes
1answer
31 views

wp_query on page template not working (Genesis framework)

I'm trying to use wp_query as part of a page template. The page is tagged with a taxonomy term and I'm trying to grab a list of posts that are also tagged with this taxonomy term. I'm able to grab ...
0
votes
0answers
21 views

Declare inline background image in functions.php

I'm not sure if this can be done as I cannot find anything to help me anywhere no matter how hard i try. I'm using Ajax to load to in posts on the press of the button. the posts that are loaded in are ...
0
votes
1answer
70 views

How to get old posts instead of recent with WP_Query?

I'm doing a WP_Query with a date_query parameter after, and I want the nearest post after that date, but I get the farest ones in the future from the date. Is there any parameter to control this? ...
0
votes
0answers
33 views

How to search posts by title, id and author? [duplicate]

i am getting the details from a custom search with the below query from a parameter $_REQUEST['search'] in the URL $custom_args = array( 'post_type' => 'post', 'posts_per_page' => 5, ...
0
votes
0answers
22 views

custom query - offset to pagination

I'm trying ot add a custom query to my pagination - category page. here is the code how it look like: <?php /** * The template used for displaying Blog loop * * Use for index/archive/search. ...
0
votes
0answers
13 views

How can I include posts with a certain meta value into a taxonomy archive page?

So for example, say I have a taxonomy "Blogs" and term "News" as well as other terms like "Food", "Sports", ...etc. On the "News" archive page, you obviously only get posts that include term "News", ...
0
votes
0answers
12 views

Is there a way to query for standard post formats along with other formats in a single query?

Let say I want to query for standard post formats along with video post formats excluding all the other formats. I can imagine the query like this: $query = new WP_Query( array( 'post_type' ...
0
votes
0answers
16 views

Is it possible to use an OR (instead of AND) between tax_query and s (search) in a query?

In the following example: $search = 'thing'; $query = new WP_Query(); $query->query( array ( 's' => $search, 'tax_query' => array( array( ...
0
votes
1answer
19 views

How to make an insert in wp_posts and use the data inside of WordPress? [on hold]

I need to do a vehicle system and would like to know how to use the wp_insert function to insert data in the Wordpress database. I must also know how to enter the meta values. Example : color, size ...
0
votes
1answer
23 views

different for loop if screen resolution < 1000px

I'm trying to have a different loop for different screen resolution... Example: one loop if my resolution is higher of 1000px widht, another one if lower of 1000px. I tried this: <div ...
0
votes
1answer
30 views

WP_query for posts with same post type AND same post category

I'm trying to display 'related articles', I do this now like this: <?php $exclude = get_the_ID(); $args = array( ...
0
votes
1answer
34 views

merge two query arguments into one WP_Query call

I'm overriding WooCommerce's default search query to include searching by SKU as well. // default search query $query_default_search = new WP_Query( array( "post_type" => "product", ...
0
votes
0answers
24 views

Get Previous & Next Attachment Links (With Thumbnails)

I'm building a theme that explicitly displays an attachment on a single page (not using attachment.php at this time, but the idea is the same). I have the 'attachment_id' value, and the attachment ...
0
votes
0answers
29 views

How to get query results for the next page

How to get query for posts from next and previous pages on Blog via ajax call? I'm thinking about making copy of the current query with offset like this: $curr_query = new WP_Query( array( ...
0
votes
1answer
22 views

How to check if a post “does not have term” in conditional statement?

We know that we can check if the particular post has a term by using this code: has_term('term', 'taxonomy', $post->ID )) { I was wondering if there is a code to check if a particular post does ...
0
votes
1answer
33 views

Query Pulling the same post twice

After seeking help and failing, I managed to write a query for Wordpress that does exactly what it's suppose to do, however it pulls the post that it's suppose to in twice. I've stared and stared at ...
0
votes
2answers
51 views

Show posts by author of membership level (Paid Membership Pro)

I am currently listing posts based on user role, with the following query: $ids = get_users( array('role' => 'author' ,'fields' => 'ID') ); $args = array( 'author' => implode(',', ...