"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

4
votes
1answer
108 views

Tracing the life of a query

I can't find documentation regarding this - but is there a way to see how a query might bounce around from one filter to another? I've got a list of possible wp_filters and their relevance but I ...
0
votes
1answer
908 views

Custom post type, custom taxonomy, query posts only from taxonomy (children of)

I have a custom post type (portfolio-type) with a custom hierarchical taxonomy (portfolio-category) Now I would like to query only posts from potrfolio-type, so i do: $paged = 1; if ( ...
1
vote
3answers
476 views

WP_Query orderby breaks when using AJAX?

I'm running in to a bit of a problem. I have a function called get_press(), it retrieves newest press items. It is inside of a plugin: class EWPress { function __construct() { ...
0
votes
1answer
208 views

How do I get the content of a custom instance of WP_Query?

I've taken a very minimalistic loop, and tried to modify it, so that I can use more then one loop on one page. The minimalistic loop works fine and gets the content. But my modification to allow it ...
0
votes
1answer
452 views

datetime picker, timestamps and meta queries

I have a custom meta box with a datepicker. The datepicker outputs 2013-01-17 10:00 in my database for an event that is 01-17-2013 at 10pm PST. $eventlist = new WP_Query(array( 'post_type' => ...
0
votes
1answer
187 views

How can I sort posts by the date and a custom meta field?

I have custom meta field that I use for the post rating. So I want to display posts by the date and the rating, but only for the posts that have specific rating. For example, I want to display posts ...
2
votes
0answers
171 views

how do i combine keyword search and taxonomy in a WP_query $args array Worpresss [closed]

I'm trying to figure out how to get the following code to work as one wp_query . i'm trying to filter the loop on the search values and the taxonomy values: Both of these sections work independently ...
2
votes
0answers
120 views

Is it possible to orderby multiple meta_keys when using meta_value_num?

Reading through the order & orderby documentation, it's not clear to me whether there is any support to order based on multiple meta_key values. Obviously, using meta_query I can return posts ...
0
votes
1answer
139 views

Performance concerns: index.php vs taxonomy-$taxonomy.php

On one of our latest projects I'm planning to use the index.php file to display different taxonomy layouts. Basically I'm planning to use is_tax( 'sometaxonomy' ) to display the data/loop for ...
0
votes
2answers
207 views

How can i simulate “taxonomy__in” in query?

How can I have to set tax_query to get results like 'category__in' => array()? Specifically, I would like to show all the posts that have a term from the city taxonomy with one of these id's: $cities ...
3
votes
1answer
289 views

get data from wp-query, outside the loop & without url change

I am working on an advanced search on wordpress based on custom taxonomies. I've been stuck for 72h so I was hoping to have some help or thought... Step 1 --- in the js file the query strings are ...
0
votes
2answers
174 views

Creating 'posts page' loop based on the page itself

The setting Settings -> Reading -> Posts Page is set to my 'News' page, and the loop for the home.php template is populated with posts... great. However I want to also be able to create another ...
2
votes
3answers
1k views

Make First post different from rest?

Hi i'm using the code below to call post from a certain Category under certain post types, But how do i style it so that i can make the first post different from the rest of the post. <?php ...
7
votes
2answers
2k views

What is “main query”? [duplicate]

Possible Duplicate: How to know which one is the main query? I'm curious to know what is the so called "main query"? What I have is two queries on front page. if (have_posts()) : while ...
3
votes
1answer
347 views

get_query_var() not working in pre_get_posts

I'm using the pre_get_posts hook to order the main query on all my custom post type / taxonomy pages using a custom meta value. As part of the logic, I am trying to determine which taxonomy is ...
0
votes
1answer
54 views

loop and in admin header problem

I have a WP_Query loop running in a function that's attached to the 'admin_enqueue_scripts' hook add_action( 'admin_enqueue_scripts', 'rs_get_scripts'); function rs_get_scripts() { //enqueue js ...
0
votes
1answer
347 views

How to get posts published on the latest date?

Is there a way of getting all posts published on the latest date? It might not necessarily be today, it might be yesterday or the day before yesterday or even a day last week.
1
vote
2answers
534 views

pagination doesn't show up for custom post type

Another user on here suggested that my use of queries was incorrect so I'm changing the code. However, the pagination in the first block of code (below) isn't showing up in the HTML while the second ...
0
votes
1answer
344 views

Loop for custom-post-type comparing taxonomy terms for “related” posts?

I have a custom-post-type named my_projects and a custom-taxonomy called project_tags. I want to write a function that is returning 5 posts of this post-type based on a given taxonomy term. So I ...
0
votes
1answer
916 views

Get post info inside modal window?

What I'm Trying To Do I have set up a custom post type for 'movies' and below is how I set up the template. Basically, I am trying to get a.thickbox (in the code below) to open a modal window with ...
0
votes
1answer
158 views

How do i add custom post types to this query?

I'm using the code below to display the latest post from a certain category but i am using Custom Post Types and I don't know how to insert the custom post type function into this code. I want to ...
1
vote
1answer
199 views

How to know which one is the main query?

I just did an action on the query using pre_get_posts and it didn't work. When I removed the $query->is_main_query() it did work. So, how do you know that what is the main query. I know there is ...
3
votes
1answer
3k views

How can i retrieve default post per page value? from settings->reading. And total number of posts?

I want to retrieve the default value of Post per page (the value that is set in settings->reading. I've looked around and so far I've only found ways to query it. problem is i dont want to change ...
2
votes
4answers
8k views

How to get Page/Post Gallery attachment images in order they are set in backend using WP_Query()?

I am trying to retrieve all the images from the Gallery of a page in the order they are set in the backend. So far I have: $my_wp_query = new WP_Query(); $all_wp_pages = $my_wp_query->query( ...
0
votes
1answer
199 views

Set order of returned items in the WP_Query() class/function

I have this function which gives me IDs and titles of all child pages of a given parent ID. function getPageChildren($page_id) { $my_wp_query = new WP_Query(); $all_wp_pages = ...
8
votes
1answer
6k views

Query all posts where a meta key does not exist

I am trying to get a query to retrieve all the posts where a specific meta_key does not exist and then create it. I am having problems finding those posts as the query I am testing does not seem to ...
0
votes
1answer
173 views

Is it possible to use WP Query to orderby custom meta value and custom taxonomy?

I have a custom post type with a custom taxonomy and I am trying to pull posts with a certain meta value along with a custom taxonomy (tag in my case). Is this possible and if so, how would the query ...
0
votes
1answer
361 views

Why does apply_filters behave different inside and outside a loop?

What I want: the array of posts returned by creating $query = new WP_Query($args); Why: to return specific content as a sort of API request in json format, ready to display on another site What I ...
0
votes
1answer
466 views

Wordpress SQL JOIN query

Hi Im trying to run 2 querys in the same query call. // send the query global $wpdb; $commentQ = "SELECT * FROM $wpdb->comments " . $whereClause . $orderBy; $comments = ...
0
votes
2answers
549 views

Change post query onclick

I'm trying to build kind of a filtering system for the events displayed on my website. I've made a custom post type 'Event', with a 'City' field. On my 'calendar' template page, I'm gathering all the ...
0
votes
2answers
1k views

WP Query with custom taxonomy

I'm just getting used to the WP Query and was hoping I could get some assistance on this. I've created a custom taxonomy (theme) and now want to display the latest post with one of these taxonomies ...
0
votes
1answer
221 views

How to WP Query custom multiple custom taxonomies?

I am trying to get all posts that belong to two or more taxonomies but I am failing... So here is the pseudo of what I have. taxonomy name = color-categories I have 6 created items under ...
0
votes
1answer
627 views

Default permalink structure causing Notice: Undefined property: WP_Query::$post

I use the wp for membership site. I use pages for the user log in, manage post, edit profile and etc. When I apply the default permalink structure, I found that the debug mode show this notice on ...
1
vote
2answers
127 views

Implementing an OR statement to wordpress wp_query

I am trying to return all posts that meet the following conditions: The category must be 63 OR the post must have a value associated with the meta key named 'android_link' My current argument ...
0
votes
1answer
1k views

How to insert multiple postmeta values with one query?

I have a custom script/plugin I am using for myself that creates a post along with some postmeta information. Right now, I have multiple $wpdb->insert, but I would like to condense this down into ...
1
vote
1answer
129 views

list tags with count in author profile page

I would like to list tags with count in author profile page just like this page If the user click the tag, then I would like to list the tagged posts. Can someone help me?
0
votes
1answer
77 views

WP_Query based on a custom field result

I would like to know if there's a way to do a query filtered by a custom field result. In this case, I have 6 posts I would like to retrieve, but only if they have "true" selected in a custom field ...
0
votes
2answers
712 views

What should I use, get_posts or wp_query for less CPU load?

I have a blog and on the main page are 3 blocks of posts. So, I get these posts with "get_post" and I have 3 similar codes on page: global $post; $args = array( ... ); $myposts = get_posts( $args ); ...
0
votes
2answers
2k views

How do I Use Multiple Loops with WP_Query?

Hi I am trying to add post from a certain taxonomy term to a cpt loop. The code below is the code I am using. <?php // Create empty array to store post ids in $excludes = array(); ...
0
votes
1answer
652 views

wp_query should show stickies first

I have the problem that my theme is for some reason always showing the latest posts at first. I would however like it to show all stickies at first and then show the regular ones. Here is the code: ...
1
vote
2answers
539 views

Query to return maximum of one post per author

We are introducing a "featured author" area on our site and would like to display the most recent articles by a select group of authors. However, we only want a maximum of one post per author to ...
0
votes
1answer
339 views

Using WP_Query and Query_post for the loop?

I am using the code below to call post from a certain Taxonomy term. My intentions are to mix that into the normal loop. I'm am not trying to create two different loops, but one loop that displays ...
0
votes
2answers
87 views

Do not show a custom post if it belongs to a certain custom taxonomy

I am trying to block the visualization of a custom post, of type 'product', if it is assigned to certain values of the taxonomy 'product_cat'. Strictly speaking, I would like to block the ...
-1
votes
2answers
108 views

Fix incorrect related posts code snippet

Can anybody fix this incorrect related posts codes snippet? function related_posts() { if (is_single()) { global $post; $current_post = $post->ID; $categories = get_the_category(); ...
0
votes
2answers
312 views

Multiple loop for “featured” items returns wrong posts

I have a page template where I first am getting the contents of the page, as input in the admin tool, then a loop of posts of a custom post type. I need to split this loop up into the 2 newest posts ...
1
vote
1answer
240 views

Crafting WP_Query array, sort by date

question about wordpress WP_Query: 'post_type' => 'event_date' outputs dd/mm/yy ex: 31122012 I would like to order my frontend 'event_date' output not by latest WP post entry but by latest ...
0
votes
1answer
820 views

Display posts where date field matches current month?

I have a loop which displays all the posts of the "events" post type on my site. Each of these posts has a custom date field "event_date", which I sort the display of the loop by. I would like to ...
2
votes
2answers
3k views

Next_posts_link() works only with original $wp_query

I've got custom template that I want to display paged blog posts. This is the beginning of my file: $wp_query = new WP_Query($args); if($wp_query->have_posts()){ ...
1
vote
0answers
129 views

Custom post query by taxonomy

I am using WordPress 3.5. My query is, $args = array( 'post_type' => array('product', 'comic', 'magazine'), 'taxonomy' => 'Genres', 'term' => 'hot', 'posts_per_page' => ...
0
votes
1answer
759 views

Displaying Portfolio Filter by Category Order (alphabetically)

I have created a custom post type to display churches in Europe. I used a tutorial to make it filterable and everything on my site works as normal. How would I organize the posts by country, instead ...