"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
1answer
67 views

Manually build WP_Query

I'm trying to manually build a query in 'loop.php' that outputs a list of 3 posts from a custom post type above the results automatically given when doing a search in WordPress. As such, I've got the ...
0
votes
0answers
49 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
17 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
1answer
47 views

CPT or Custom Table for Repository of Serial Numbers

My app allows users to purchase products from a WooCommerce store. But I need to attach a serial number (cannot be generated on the fly) to each product, depending on type, size and design. The ...
0
votes
0answers
25 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
87 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
30 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
1answer
20 views

Sorting posts by meta values: 2 different orders

I have a meta value for a custom post type called workshop which is the start_time of the workshop as a UNIX timestamp. Right now I'm able to sort the posts ascending or descending with ...
0
votes
0answers
29 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
1answer
56 views

Group posts by attachment meta key

I am trying to group posts by meta key. So far I am able to show all the posts with the meta key ('grouping') but with this it is listing the grouping with each post. What I want to achieve is list ...
0
votes
0answers
10 views

wp_query not returning results on tax_query [duplicate]

Here is code to start the question function myfunction(){ global $wpdb; $search_string = urldecode($_REQUEST['s']); var_dump(get_term_by('name',$search_string , 'gift_tag' )); //This ...
0
votes
1answer
80 views

Query posts by specific word on title

Is it possible to query posts by a specific word on title? Example: I have 3 posts inside my blog and only two have the word car on the title. She wants a ride on my truck My car is super fast ...
0
votes
0answers
76 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 ...
1
vote
1answer
111 views

How to Filter Posts by Custom Fields?

I would like to learn the best way to filter custom post types by custom fields. In the example I am working on, I use custom taxonomies to organize my posts and filter them. I would like to add ...
2
votes
2answers
103 views

Filter and list posts of a custom taxonomy

I have a custom Taxonomy called 'owner' and it has multiple posts as owner names (Using as a category) so I can filter posts by 'owner' taxonomy. I'm trying to make an index page of all owner names ...
1
vote
1answer
50 views

From where is archive.php getting its posts?

My archive.php starts like this: get_header(); ?> <?php if( have_posts() ): ?> <div id="container" class="portfolio-wrapper"> <?php while( ...
0
votes
0answers
28 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
3answers
194 views

Wordpress Blog Posts with Pagination inside a Page/Post

Refer to the title, I'm trying to create a shortcode for Blog Post with Pagination. I'm able to show the blog post but the pagination is not working. I tried using the code below and the link to ...
0
votes
2answers
35 views

Not all posts showing in query

PHP: <?php $posts_query = new WP_Query('post_type="posts&posts_per_page=-1"'); if ($posts_query->have_posts()) : while ($posts_query->have_posts()) : $posts_query->the_post(); ?> ...
0
votes
1answer
25 views

How to get hierarchical number of custom taxanomy

I have custom taxonomy some thing like : Item - A Item A-1 Item A-2 Item A-2-1 Item A-2-2 Now i want to get what is the number of hierarchical number of Item A-2, if we start from 0 it ...
0
votes
1answer
59 views

How to add post_distinct filter to WP_Comment_Query?

I want to fetch a list of posts with the most recent comments. However I don't wish to simply get the latest comments and have duplicate posts, but I want to group the posts (by their ID). I tried the ...
0
votes
0answers
27 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
1answer
47 views

Error in meta_query not get result

I have this WP_Query <?php $args = array( 'post_type' => 'banner', 'posts_per_page' => 25 , 'meta_query' => array( 'relation' => 'AND', ...
0
votes
0answers
20 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) { ...
2
votes
1answer
63 views

Help with CPT template pagination

i created a themes CPT using the following code function pp_themes_post_type() { $args = array( 'public' => true, 'label' => 'ProfilePress Themes', ...
0
votes
0answers
21 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
47 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
35 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 ...
1
vote
1answer
363 views

Error : “Cannot use object of type WP_Post as array in”

Fatal error: Cannot use object of type WP_Post as array in C:\xampp\htdocs\wordpress-4.3.1\wp-includes\query.php on line 3716 I don't know what is this I am searching from internet but not find ...
2
votes
1answer
139 views

How to check if I'm on a custom post type archive in the admin area

I am trying to alter the query that's ran on the admin page of my custom post type. This page: /wp-admin/edit.php?post_type=my_venue. Typically, I would use is_admin() && ...
1
vote
0answers
72 views

How to add custom query filters in WP_User_Query

I am creating a list of all users in wordpress. For that I am using WP_User_Query with meta_query so that I can show only filtered users. I am stuck where I want to add a custom query filters in ...
0
votes
0answers
20 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
34 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
1answer
52 views

Check for the main query from the template

Besides the main loop in index.php, I'm calling several other custom queries across the theme, like this: $new_query = new WP_Query(array( // some args )); if ($new_query->have_posts()) : ...
0
votes
1answer
75 views

date_query is showing duplicate results

I'm trying to get the posts that was updated from today, yesterday and 2 days ago but 2 days ago is showing the result of yesterday. What seems wrong with my code? Today and Yesterday is working fine. ...
0
votes
1answer
97 views

Use not custom fields in get_posts() meta_query?

Is it possible to use not custom fields in get_posts()'s 'meta_query' to use a or-relation statement with a custom field and a category id? Like this: $args = array( 'posts_per_page' => 6 ...
2
votes
1answer
37 views

How to display the modified post today

I'm trying to figure it out how to display a post with modified/updated today. Sql is possible with post_modified_gmt < 'datetoday' but can't find the function for post_modified_gmt on wp_query. ...
0
votes
0answers
78 views

WP_Query with multiple select fields

BACKSTORY: This is part of my WP_Query foreach loop, there are many fields that it takes into account (text, number & these are taxonomies). It works nicely like this. case ...
0
votes
0answers
85 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
3answers
119 views

Display posts if a custom field value is equal to another custom field value

I have 2 custom post types "Shops" and "Restaurants". Each of these have custom fields associcated with them. For example, One field in Shops is "Shop ID" and one in Restaurants is "Restaurant ID". ...
0
votes
0answers
34 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
23 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 ...
1
vote
0answers
19 views

WooCommerce - display category X first

I have 4 categories in my WooCommerce store: Cat1 Cat2 Cat3 Cat4 Is it possible to list them (in asc order) on the shop page as: Cat3 Cat1 Cat2 Cat4 ie, show Cat3 first, then the other ...
0
votes
1answer
26 views

Showing Children of page by name

I have a page like this phyiscs ---mechanics ---statics ---Universe chemistry ---Reaction ---Equilibrium biology ---Human body ---Polination I want to display the chilren of page ...
0
votes
0answers
33 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
25 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
3answers
146 views

Skipping first 3 posts in wp query

Here's the query i have used. <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $wp_query = new ...
0
votes
1answer
206 views

Date and Category query with filter

I am a little confused by this. I have a query that finds posts within a category and date. I can filter the categories, but I have no idea how to filter by date. The query works. I see all of the ...
0
votes
1answer
154 views

Ordering posts by custom field and grouped by month

I need display all custom posts (event), order them by custom field (date) and group by month: September Event 1 Event 2 August Event 3 July Event 4 Event 5 I know, it is frequently asked ...