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

Pagination Not working on Home Page with 2 Query

I have two loops in home page (index.php) <?php $args = array( 'post_type' => 'post', 'posts_per_page' => 3, ); $another_query = new WP_Query($args); if( ...
0
votes
1answer
26 views

Query custom post type by custom taxonomy (category slug)

I've followed several related solution. But I'm still facing the problem. I've applied the following code for my custom post query by taxonomy (category). But it's not working. I think my problem with ...
0
votes
0answers
18 views

Custom Field - Save Pageviews For Specific Time Period

I have a custom field called page_view to save page views. Now I need another custom field called page_view_last_24_hour to save page views in last 24 hour. Is it possible to use custom field to ...
0
votes
2answers
43 views

How order posts from category by date and comment count?

Just like in topic I try to order posts from category by date and comment_count but code below doesn't work: <?php //get post from current category $category = get_the_category(); ...
3
votes
1answer
80 views

Calling a wp_query $posts causes a 500 error

I had a very basic wp_query, below: // WP_Query arguments $args = array ( 'post_type' => array( 'post' ), 'post_status' => array( 'draft' ), 'posts_per_page' ...
0
votes
1answer
26 views

How To Call WP_Query From A Subdomain?

I have a PHP script running in WordPress, that uses a WP_Query to get the posts from one of my subdomains and return it as a JSON string. The script only receives the post data if I call it using the ...
6
votes
1answer
682 views

Wordpress get_posts function, 1300 lines long

I'm just getting started learning about the WordPress Core. WordPress's codebase is the first large codebase that I've looked thoroughly into. The get_posts method in wp-includes/query.php is 1300 ...
0
votes
0answers
22 views

Customize add to cart

I have created a page of getting custom values from the customer but the process will be taken place in steps like select lesnes click next select product frame click next so all the information ...
0
votes
2answers
42 views

Display specific page (that is child) content on parent page

I have problem displaying child page content on parent page (both static). I can display other page content but only if on same level. It dosent work in relation parent - child. <?php ...
1
vote
4answers
75 views

How do I query for posts by partial meta key?

I have a function that stores the "like" status for a post as post meta. I want to associate that "like" with the user that liked it, so I setup a custom field called "like_status_{user_id}" (where ...
0
votes
1answer
33 views

active link for most recent post on vertical tabs

I'm trying to add the css class .is-active to my vertical tab links inside my loop. By default, the page loads the most recent post first. How can I make most recent tab/post active with .is-active? ...
0
votes
1answer
36 views

How to allow Readers to Select Post Order?

I added a select field for every category, tag archive page. Sory By Post Date Sort By Post Modified Date Sort By (custom field) When a reader select any of above how to load posts according to ...
0
votes
2answers
55 views

Conditional posts in WP_query for search

I have a custom post type that im trying to limit results in search. The CPT is a deal/coupon, with a start and end date for each of the deals. What I'm trying to do is only show these posts in ...
0
votes
0answers
28 views

How to allow users to select post order in any archive page?

I have build a something like forum using WordPress (Not using plugins). Now I want to display select filed to select user to post order ( Most recent posts, most active posts, most votes post, ...
0
votes
0answers
25 views

Insert single CPT items every x posts of another CPT

I know there is something similar already discussed here, but I cannot seem to get my head around this to fit my current project and needs. For a portfolio, on a query of portfolio entries (custom ...
4
votes
5answers
140 views

Return parent post with its children using WP_Query?

In some cases it might be useful to use multiple post & page parameters in your WP_Query object. In my case, I would like to display children of a parent page including the parent page itself. ...
0
votes
1answer
52 views

Extending WP Query: Custom geolocation meta values work, but tax_query breaks

I've built a custom query for geolocation searches. I'm saving lat and lng within each custom post type as a meta value. My query extension returns results successfully when lat and lng are the only ...
0
votes
1answer
51 views

Wp_query WooCommerce products

I'm currently developing an e-commerce store using Wordpress and WooCommerce. I'm planning on creating a basic product filtering system and was wondering if it's possible to wp_query the results shown ...
0
votes
0answers
30 views

WP_Query order by number of likes

I'm trying to configure WP_Query to order by number of likes. I have a custom table called 'likes', which records which liker (user ID) likes which post: id | liker | post_id 1 | 11 | 120 2 ...
0
votes
0answers
36 views

How to initialize a new WP_QUERY object in custom wordpress page?

I am new to PhP and Wordpress development so this might seem a completely newbie question. I am testing the wordpress development platform and have created a new PHP blank page in a theme directory ...
0
votes
1answer
50 views

Why do I have to use pre_get_posts with custom WP_Query to reset posts_per_page?

This makes no sense , I am using custom query in archive.php to do masonry layout. $term_id = get_queried_object_id(); $paged = 1; if ( get_query_var('paged') ) { $paged = ...
-1
votes
1answer
102 views

How to show all posts of specific custom post type with their custom fields values?

I am trying to get the list of all posts with post_type "staff" along with custom fields assigned to this post_type. Custom fields were create with help of ACF. I've tried both: $query = new ...
0
votes
1answer
25 views

Display post from a date range from custom field

I currently have a custom post type that has two major custom fields that are need for the query. The 'score_time' field stores time of a score. Example: 12:20 The 'score_date' stores the date the ...
0
votes
0answers
31 views

Can't combine 'post' and custom post types in same query

I have a totally weird situation! For me, in Google Chrome; this query (used to generate a slider on the front page) produces the expected result (content from all four post-types): $args = array( ...
0
votes
1answer
39 views

Wordpress Bootstrap Grid

What's the best way to create a grid layout using bootstrap, or see link below http://v4-alpha.getbootstrap.com/examples/carousel/ displaying three different headings, should i use wp-query or, ...
0
votes
0answers
28 views

+ 0 in ORDER BY

My $args: Array ( [post_type] => course [showposts] => 99999 [orderby] => meta_value_num [order] => DESC [meta_query] => Array ( ...
0
votes
0answers
29 views

Using WP Query to combine posts and taxonomies

I'm trying to use wp_query to create an index of posts, but I want to combine post titles and a custom taxonomy to create this output on the page: Cheese (a single post title, arranged ...
0
votes
0answers
53 views

WP_Query and Infinite scroll

I'm using the infinite scroll jQuery plugin in all the archive pages but, that's strange, is working just in a few of them. Here an example: this is working and this is not. As you can see, the script ...
3
votes
1answer
61 views

Nested query inside Logical operator OR not working in meta_query

I've been trying this for hours now and I have searched and haven't gotten a clue. I am trying to make a nested query with OR operator as a parent and AND operator inside it as child. The page keeps ...
0
votes
1answer
42 views

Group by custom field value (start and end times)

I have the following loop that is outputting a schedule for a conference. At the moment it's looping through a custom post type, grabbing the info, then outputting it in a block. So essentially each ...
0
votes
0answers
29 views

Custom filtering/search

I would need to do custom search for my archive page that would filter based on metakeys, freeword and couple select options. Probably my best option is to use the normal wordpress search ...
8
votes
3answers
421 views

$GLOBALS['wp_the_query'] vs global $wp_query

What is the difference between $GLOBALS['wp_the_query'] and global $wp_query? Why prefer one over the other?
0
votes
1answer
42 views

Nested array issue in meta_query

I am using following meta_query to search blog post according to following search criteria, search logic : if expire date set, check the expiry of the post, otherwise just include it if ...
0
votes
0answers
26 views

WP_Query pulling all content even with readmore

I'm using a plugin called quicksand that is working for the most part. It hasn't been updated in 2 years though so support there isn't an option. I just noticed though that even though I'm putting a ...
0
votes
1answer
34 views

How to get CPT category checkbox list and show post of selected(multiply) checkboxes via ajax?

I want to create a plugin that outputs Custom Post Type category checkbox list(as in back-end WordPress) to show CPT posts that contain selected on front-end categories(multiply select) after pressing ...
3
votes
2answers
62 views

Ignore post by meta value in the main query

I use this function to insert at the beginning of the loop two post at my convenience (with meta key and value) add_filter( 'posts_results', 'insert_post_wpse_96347', 10, 2 ); function ...
0
votes
3answers
65 views

WP Query and order by particular specified IDs

My WP_Query request looks like: $query_args = array('posts_per_page' => $products, 'no_found_rows' => 1, 'post_status' => 'publish', 'post_type' => 'product' ); $query_args['meta_query'] ...
0
votes
1answer
58 views

Order wp_query by calculated field

Hi I'm working on a store locator. I have a custom post "clinics" where I save clinic details (address,.., lat, lng). Each time I publish a new clinic I save post_id, lat and lng also in a custom ...
0
votes
0answers
20 views

WP_QUERY with alternating post types and pagination [duplicate]

I want to show both regular posts and a custom post type (event) on the homepage in a single loop. The event post type needs to be ordered by a custom field for the event date and show future events. ...
0
votes
1answer
64 views

2 Loops on one page - pagination of 2nd loop ignore array of excluded posts

I have 2 loop on one page. First one shows 11 recent posts in rand order and pushes each post ID into do_not_duplicatearray. $argsRandom = array( 'numberposts' => 11, 'fields' => 'ids' ...
0
votes
1answer
44 views

WordPress: Cron locking and Queue

I have some CPU intensive scripts that I don't want to run concurrently. Every now and again the scripts will overlap and crash the server. Already at 2GB and the mysql container still crashes. I ...
0
votes
2answers
52 views

wp_get_attachment_image not to get the post_thumbnaill

I have a setup, where I want to achieve that I have a big Picture of a product (Post-image), and then below a list of other thumbnails, which can be opened in a Lightbox. I made this, by querying the ...
0
votes
1answer
39 views

Custom Query include private posts in pagination count calculations?

I have run into some trouble with pagination using a custom query to display both private and published posts from a category. Here's my custom query: $paged = ( get_query_var('paged') ) ? ...
0
votes
1answer
25 views

WP Query for variable taxonomies

I am stuck with this. Maybe its simple, maybe its not. But there goes. I understand that the standard way of querying multiple taxonomies in wordpress is using the method described here. ...
0
votes
0answers
25 views

WordPress database error:

Thank you in advanced for any help on this issue. I have this query: $query = $wpdb->update($tablename, array( 'student_first_name' => ...
0
votes
1answer
33 views

How to extend tag and category “Related Posts” query to custom post_type if the first 2 terms have no posts

Scenario I am using a complex, awesomely crafted tax query to get up to 4 related posts, first going by tag, then by category if there are not enough posts in tag-related query. This was finely ...
0
votes
1answer
61 views

$query_args for loop to only get posts from “current category”?

I've ran into trouble, i do not understand how to make my custom query respect the current category i'm browsing. Lets say i'm in category "test1" and i have this custom query loop: $paged = ( ...
0
votes
1answer
24 views

Different Loop for tag pages?

I have a theme that uses one template file to render the index of the blog, the loop is basic: if ( have_posts() ) : while ( have_posts() ) : the_post(); I want to use another custom loop for all ...
2
votes
1answer
44 views

How to do a query only on a specific admin page?

I'm making a page for settings API using Codestar Framework, and loading fields using their filterable configure - question is not related to Codestar. In one of such dropdown field, I need to load ...
0
votes
1answer
28 views

Conflict array_splice on loop and query in widget

I am using the function array_slice to insert two post within the loop in the index. function insert_post_wpse_96347($posts) { global $wp_query; $args = array('meta_key' => 'Caja', ...