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

Show recent posts from excluded category

I want to exclude category posts from index & archive pages, so I wrote this script in functions.php: function exclude_category($query) { if ( $query->is_home() || $query->is_archive() ...
0
votes
0answers
90 views

Querying custom tables using WP_Query

I am looking to extend the WP database by adding a custom table. I know how to do it using the $wpdb object; however, I have seen on some sites that it is better to use the WP_Query class, but I can't ...
0
votes
0answers
19 views

Retrieve images separately from multiple galleries within same post?

I am running WordPress 4.3.1. As part of a new feature, I am able to "add media" and create two or more image galleries. How can I use WP_Query to retrieve the images attached to each gallery ...
0
votes
0answers
29 views

Query all posts sorting first by the ones that match criteria, then the rest

I have two custom post-types 'office' and 'work'. A work is made by one office (I store the office ID in a meta of the work, named OFFICE); Now, in single-office.php, I need to list all the works, ...
0
votes
0answers
30 views

Editing custom post type

I've to do some edits to wordPress theme home page . This is the scenario. There are 4 posts being showed in home page under news tab now when i check this is using front-page template and in ...
0
votes
0answers
105 views

Querying posts based off a jquery datepicker

I have two jquery date pickers that i'm trying to filter post with. I store the jquery date picker values into a hidden input. Then i'm grabbing them with a php $_POST[]. I'm using meta_query to query ...
0
votes
0answers
45 views

Website goes slow down after importing long database

I am working on a site which have 2 lakhs post and 15 categories. I have home page with 3 post of each category on home page. And after that its goes down while run home page and shows page not found. ...
0
votes
0answers
48 views

Ordering Posts by parent category, name ascending

I am currently creating a theme, and I have 2 parent categories: Budget and Brand. On home.php, I want to order all the posts ascending by their sub category name without showing the category title. ...
0
votes
0answers
91 views

Masonry layout within the loop

I have tried to to make a custom query, to some extend. it is working fine. But where i cannot make it work, is it to break after every 3 posts and do same thing (print div.row) and run same loop, For ...
0
votes
0answers
40 views

How to only show sticky posts in archive.php using WP_Query()?

Is it possible to slightly change the default query instead of building it from scratch? I started with the code below and it works. But all taxonomy filters do not work any longer. ...
0
votes
0answers
34 views

WP Query using Advanced Custom Fields data

I have a page 'Repertoire' that uses a specific page template. The page has an advanced custom fields repeater field for 'Title' (text), 'Artist' (text) and 'Genre' (select). On the front end, I need ...
0
votes
0answers
22 views

get_results no result back

I can't get a result back from this query...any suggestion? function per_match(){ global $wpdb; $myrows = $wpdb->get_results( "SELECT id FROM partite;"); foreach ($myrows as $myrow) { ...
0
votes
0answers
27 views

Query post & comments at the same time?

I have this query : $custom_query_args = array( 'post_type' => 'stream', 'post_status' => 'publish', 's' => $username, 'posts_per_page' => '10', 'paged' => $paged ); $loop = new ...
0
votes
0answers
69 views

Custom post type pagination page 2 404 error

Sorry to repost this but I haven't found a solution to my problem. I registered a custom post type instructor-emails and when I try to make the archive one post per page, the other pages return a 404 ...
0
votes
0answers
51 views

Trouble displaying custom fields within post type in WP_Query Loop?

I'm trying to write a query that displays a custom field within my custom post type 'Inventory'. The custom field name is category and the field type is taxonomy. The category is selected by a ...
0
votes
0answers
21 views

How to sort by meta value, then by other meta value

I've been tasked with creating a 'fully automated' agenda for my client. The goal here is to create an agenda for a conference. The idea is that one shortcode will automatically populate the entire ...
0
votes
0answers
47 views

wp_query with shortcode do_shortcode out of while

I have a theme that uses an accordion that needs nested short codes. I'm trying to get it to work in my wp_query. [av_toggle_container initial='0' mode='accordion' sort=''] [av_toggle title='Toggle ...
0
votes
0answers
109 views

Meta box field in wp_query

I am working with a recipe site. I need to filter some meta box field in my wp_query. But I can't. I have searched in google 2/3 hours. No solution. Here is my code: // Meta Box Field array( ...
0
votes
0answers
41 views

How to Create Random post once in a day

Hello Guys I am having issue with the code i found here I wanted to add specific custom post type to be randomized once in a day and i used the code i found here but that repeating the content on ...
0
votes
0answers
24 views

Query posts in current category but not attachment format

In my category.php i want to query posts in the current category but are not in post formats attachments. How do i achieve this? I currently have the below code that displays all the posts in the ...
0
votes
0answers
34 views

Custom WP_Query Not Displaying Anything

I am attempting to write a custom WP_Query to display posts by category, and I can not get these posts to display. I am using a child theme of Flat Bootstrap. Below is the code: <div id="primary" ...
0
votes
0answers
26 views

WP_Query for liked posts is showing all posts if none are liked

I'm using the plugin Favorites for WordPress to allow visitor's to like products presented with a Masonry grid on the site. On the site I have a page which lets the visitor see all his or hers liked ...
0
votes
0answers
32 views

Orderby Date and Category

Query and order by date, or query and order by category is no problem, but is there anyway to order by date and category? So if I query 30 Events (CPT), there might be 5 events per day so I want them ...
0
votes
0answers
98 views

How to get wp_redirect to work correctly

I have a new site that has had a permalink structure update. Old Structure: http://blog.mysite.com/%postname% New Structure: http://blog.mysite.com/%category%/%postname% My thought process was to ...
0
votes
0answers
191 views

Add relation OR to product attribute filtering

I have a WooCommerce shop, where products can be filtered by product attributes. On the frontpage a i have a filter, where i build url queries. So if i choose to filter by eg. "Artist name" and ...
0
votes
0answers
82 views

How do I get pagination working with custom wp queries?

I've created a custom query within a Page Template: $args = array( 'posts_per_page' => 9, 'paged' => $paged ) ; $my_query = new WP_Query($args) I would like the user to be able to ...
0
votes
0answers
60 views

Is there a good way to get all queried taxonomy terms?

For most cases, getting the queried taxonomy term is as simple as calling get_queried_object(), but I have noticed that if multiple taxonomy terms are queried, that function only returns one of them. ...
0
votes
0answers
80 views

WordPress - Meta query with JSON value?

Im using post meta to store some value. Im having the following in wp_postmeta table: meta_key mykey meta_value a:2:{i:0;s:1:"5";i:1;s:1:"2";} I need to return posts which have meta_value of 2. ...
0
votes
0answers
87 views

Multiple loops on search results page return empty on no results

I've got a search results page that has several loops on it. One loop returns our most popular posts, and the other returns the top 5 of another custom post type. We use these loops on the blog, on ...
0
votes
0answers
28 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 ...
0
votes
0answers
18 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
0answers
49 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
0answers
18 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
0answers
12 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
34 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
0answers
63 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
17 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
0answers
304 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
0answers
83 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
0answers
96 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
24 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
67 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
26 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
0answers
90 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
58 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
0answers
67 views

How to get additional query parameters after a url rewrite

DISCLAIMER: Wordpress novice here. I'm trying perform a custom rewrite rule - and I believe Wordpress is stripping the additional query values from the rewritten url. example url: ...
0
votes
0answers
108 views

Order Custom Field by Price

First of all i've found numerous, topics, and, issues about ordering a WP_Query by its custom field value, but somehow all the proposed solutions don't seem to work for me. I have a custom field ...
0
votes
0answers
74 views

How to link a custom post type status to the user id

I'm currently trying to modify a plugin : Wp job manager application (addon). It allow user to reply via a form directly to a job proposal. After the user submit form. It's creating a custom post ...
0
votes
0answers
68 views

Meta Query Filter by Tag

I currently have multiple pages, and in each page is a custom field which is named 'country'. In the 'country' field I have this value 'uk, usa, brazil'. What I'm wanting to do is display posts on ...
0
votes
0answers
32 views

How to solve this script problem in theme directory?

I have a jQuery Ajax call that calls a php script. This call works if the file is in the root of the site but does not work if this php script is in the theme folder . Additionally, I have a 500 error ...