"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

3
votes
1answer
80 views

WP_query taxonomy + get all posts with two terms from same taxonomy

This is a follow up question to Add_query_arg + two times the same argument? I want to get the post count from all posts tagged with 2 different tags from same taxonomy $args2 = array( ...
0
votes
0answers
27 views

How to show the posts list into a static page? Problems to use the loop into a static page

I have the following problem: I have to create a posts archive into a static page. So I have created this page template containing the loop to interate on my posts: <?php /** * Template Name: ...
0
votes
0answers
519 views

How to load more custom type posts through AJAX & LOAD MORE POSTS button

Guys I am a little stuck here. Unable to load posts from a custom post type through AJAX. Normally I have had been using this script http://goo.gl/lwfM5 It seems so that $wp_query is not getting the ...
0
votes
0answers
44 views

Memory size exhausted when extending WP_Query

I tried to create a class that extends WP_Query, but I got this error: Allowed memory size of 1073741824 bytes exhausted I've increased the memory size in wp-config.php but that doesn't affect. ...
4
votes
2answers
191 views

count posts from custom taxonomy terms by year

I want to build statistics-like tables with the count of posts in given custom taxonomy terms and display them by year along with the total post count from that year. For example: 2014 ...
0
votes
0answers
36 views

Horizontally paginate through sets of blog posts?

I have my posts set up like this: I would like users to scroll through the posts using the left and right arrows. So when users click on the right arrow, for example, the next six posts would slide ...
0
votes
0answers
37 views

Run a Wordpress function inside a wp_query loop result [duplicate]

I have a search results page that displays multiple results in a multi column layout. I am trying to run a function via a button/link that will allow users to add that post to a "favorites list". The ...
0
votes
1answer
35 views

Sorting posts by Multiple custom fields in defined order

I'm currently sorting some posts out by custom fields 'role' and 'surname', using the following: function customorder($orderby) { return 'mt1.meta_value DESC, mt2.meta_value ASC'; } $args = ...
2
votes
1answer
18 views

How to get_queried_object on multiple objects?

My Setup I have a custom post type "zap_apartments" with 2 custom taxonomies "zap_audience" & "zap_cities". I wrote some RewriteRules to access all "zap_apartments" for a "zap_audience" + ...
0
votes
2answers
71 views

How to get all unique categories for posts in loop?

I'm looking to get a plain list of the unique categories in a custom loop (only categories for the posts in the loop). I've been fumbling with some code for a bit and here's what I've got: <?php ...
0
votes
0answers
17 views

Multiple loop to display specific post at start of a list

I'm currently querying the following posts: <?php $args=(array( 'post_type'=>array( 'premium_content', 'post'), 'posts_per_page' => 3, 'orderby' => 'PREMIUM_CONTENT_FIRST!', ...
0
votes
0answers
21 views

Carrying values from page to page using custom query

Im having trouble paging a custom query and I hope one of you can spot my error and point it out. I've been looking at it for long time and tried many solutions but none seem to work. The code which ...
0
votes
1answer
37 views

Query Event Posts by Date

I am trying to query custom post type (Event) by the current date and the event's start and end date. I would like three options: current, upcoming and past. This is the code I am using, but it is not ...
0
votes
0answers
21 views

Order by post_type within loop

Envision the following: <?php $args=(array( 'post_type'=>array( 'premium_content', 'post'), 'posts_per_page' => 3, 'orderby' => 'PREMIUM_CONTENT_FIRST!', 'meta_query' => array( ...
0
votes
1answer
65 views

I need to run a AJAX Fuction from within a WP_Query but only works on first item

I have a page where users filter results from the Ultimate WP Query Search Filter plugin. The results are shown in a DIV via an AJAX call. This is working 100%. However I have another AJAX function ...
0
votes
1answer
49 views

Remove echo from shortcode

I've just started playing with shortcodes and due to my lack of php knowledge I am unable to figure out how to make this shortcode work without using php echo. Can anyone help me revise my code? // ...
0
votes
0answers
14 views

Get first page of given category

I am not a WordPress expert, so I'm seeking your help. I need parent ID of post category (closest parent, not "grand-parent"), then use it to get the first post of that category. I have folllowing ...
0
votes
0answers
33 views

global wp_query returning wrong post vars

I am currently filtering the_posts to recreate wordPress' "sticky post" function for custom post types. I also have to make sure that the sticky post is attached to a certain taxonomy term that ...
-1
votes
2answers
25 views

How to modify this function to exclude also the post belonging to a specific category?

I am very new in WordPress development and I have the folglowing problem. I use this function (declared into the functions.php file of my theme) to modify the main query in such a way that the post ...
0
votes
1answer
126 views

Create new Wordpress post [wp_insert_post] based on results of a WP_Query

I have a a page where users can filter a list of custom post-type posts based on the "Ultimate WP Query Search Filter" plugin. Results are passed to a div on the page using AJAX from there users can ...
0
votes
2answers
165 views

Pagination/infinite scroll with WP_Query and multiple loops

I need that the main page of my site have 3 columns: - The first having the 5 most viewed posts; - The second with the next 5 most viewed posts; - The third with the most recent posts. I don't want ...
0
votes
0answers
69 views

Geo My WP automatically list posts based on visitor's location

Is it possible to affect the WP loop to automatically only list posts based on the visitor's location with the Geo My WP plugin? I'm creating a news site that will serve several towns and I'd like to ...
0
votes
0answers
51 views

Problem with correctly registering query variable

I have an admin page for my plugin, which lists records from database. I want to sort them under some conditions. To call different sorting options, I've decided to use query string. Step 1: At ...
0
votes
1answer
58 views

WP_Delete_user link creation

I am trying to create a user management via front end but i am not sure how to implement wp_delete_user Delete link add_action( 'wp_head', 'my_action_javascript' ); function my_action_javascript() { ...
0
votes
0answers
41 views

WP_Query, How to identify if the offset reached the max posts count

I'm doing a custom WP_query to populate my post list via AJAX with some filters. I load additional posts once the user click the 'Load More' button, this fires the $.ajax and on success adds the new ...
0
votes
0answers
48 views

Multiple Loops on a Custom Homepage

I have read many posts here and across web. I can't see why my loops return nothing (or the right query). Here is my code for multiple loops on a custom home page. Anyone know why my loops are not ...
0
votes
1answer
30 views

$args Orderby The number

I have this code $cat_args=array( 'include' => '42,210,21', 'orderby' => '42,210,21', 'order' => 'asc' ); $categories=get_categories($cat_args); foreach($categories as $category) { ...
0
votes
1answer
87 views

$wpdb select date range of posts

0 down vote favorite Using this SQL query to sort users by how many votes(meta key) their posts have received. <?php global $wpdb; $results = ...
1
vote
1answer
78 views

Using AJAX to generate front end / viewer end pages

I am currently trying to send certain data via POST method from code in the widget of my plugin to the theme's archive.php page. The code that contains the data for jquery/ajax is : <a ...
0
votes
1answer
30 views

Query function not executed between <div> element [closed]

I'm wondering why the following code is not executed between the element it's put in. I know sort of how to fix, but I'm not sure if that's the best solution. My code: First function function ...
1
vote
1answer
169 views

Some doubts about how the main query and the custom query works in this custom theme?

I am pretty new in WordPress theme development and I'm not so into PHP (I came from Java and C#) and have the following situation in this custom theme As you can see in the homepage I first show a ...
0
votes
1answer
26 views

Alternative to query->set that appends conditions instead of overriding

I am applying a taxonomy condition to the main query in my plugin which is excludes an array of post formats from it. It's being done as follows: $query->set('tax_query', array( array( ...
0
votes
2answers
52 views

How to orderby meta_value_num with dollar ($) sign

The custom fields all have prices including $ signs, and a dot as separator. $theQuery = new WP_Query(array( 'orderby' => 'meta_value_num', 'meta_key' => 'price', 'order' => ASC )); All ...
0
votes
1answer
104 views

Custom Search Query – include only custom fields and title

I have a custom post type and I also need a custom search. I want the post title and two custom fields to be indexed/queried. I found solutions for title only and for custom fields but not for both so ...
3
votes
3answers
123 views

Display posts the match taxonomy term linked from wp_list_categoies?

This should be simple, but it escapes me. I have a custom post type and a custom taxonomy. The taxonomy is named "asset_type" and the slug is "type" I am using wp_list_categories to provide a ...
0
votes
1answer
43 views

list posts of two post types in a single template

I have two post types. One is post & other one is event. Both sharing same categories & tags. I am listing the posts by archive.php. Now I am listing the posts as general by two different ...
2
votes
1answer
56 views

Including only current user's posts in search

I am a new WP plugin developer. I want the search page to include only the current user's posts. I first added a new capability read_others_posts to only administrators and editors. Then I tried the ...
0
votes
1answer
450 views

Woocommerce query all products and categories

I need to generate xml file from all my products. My current query shows all product names, but how to access categories for each products? All the products have categories and subcategories. My ...
0
votes
0answers
34 views

How to get specific records from table using multiple parameter

Bellow is my table structure wp_woocommerce_order_itemmeta meta_id order_item_id meta_key VALUE 1 2 Dining Date 2014-10-22 2 2 Booking Time 3:00 ...
0
votes
2answers
56 views

How do I order pages and categories by ID or name in the same query?

I would like to query most of my pages and categories on the homepage. So far I am able to get the pages and category (posts), but I cannot order the list the way I want to. I want to be able to get a ...
0
votes
0answers
45 views

Comments pagination and WP_QUERY

I have a list of posts using wp_query On each post theres a list of comments What Im trying to do is to limit the number of comments to 2 and display a link for the next page of comments which I'm ...
0
votes
0answers
49 views

Sorting meta_value as integer doesn't work

This plugin uses the below chunk of code to print the top 10 highscores. But this doesn't get the list of top 10 scores sorted by meta_value in my WP install $scoreboard = new WP_User_Query( array( ...
0
votes
1answer
45 views

localizing variable on front-page.php template fails but succeeds on single page and taxonomy archive

I have the following code in a php include file: function pass_the_var() { $video_embed_code = jkaw_oembed_code(); return array( 'embedCode' => $video_embed_code ); } ...
1
vote
2answers
62 views

Query that loads a custom type AND posts whose ids are not inside those custom types custom fields

On my news website I have posts and another custom type called "aggregato". This type has 10 custom fields, "link01", "link02"... "link10". Both posts and aggregato has a meta key, called "home", ...
0
votes
0answers
63 views

Fire query on ajax post url page

Here i am sending the ajax response to load_post.php page from my ajax call.I am getting response on load_post.php on load_post.php i have to fire word press query. I was try this but getting bellow ...
3
votes
1answer
174 views

How can I reduce the number of database query calls for this custom homepage?

I am working on the design of a blog with the below(just a sample) category hierarchy. PARENT | ...
0
votes
2answers
91 views

WP_Query issues with argument posts_per_page

I have a query that displays the names of donors as well as a dedication. It displays using a date meta query. $args = array( 'post_type' => 'donors', 'order_by' => 'id', 'order' => ...
0
votes
0answers
53 views

How to organize a WP_Query's list of posts by category and display category title?

If I run a query with some args and get a list of posts, how can I organize the posts separated by category and display the title of each category? $array_out = array(); $args = array( 'orderby' ...
0
votes
1answer
35 views

$wp_query when new WP_Query

I'm trying something but I have an issue with WP_Query. I've an Hook on the_post in order to add some variation on the query. add_filter('the_posts', 'query_variation'); function ...
0
votes
1answer
157 views

Remove duplicated values from a loop

I have a loop that outputs <option> fields for a <select> group. It contains many cities' names for many travel packs that I am publishing. The trick is that I need avoid repeated values. ...