"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

1
vote
1answer
456 views

Paginated HTML Sitemap

I've got to the point where I needed to break down my HTML Sitemap into several pages. It contained 2000+ links. The big layout was showing all post titles under category names on one page. I decided ...
0
votes
2answers
214 views

How to order by multiple date meta_values?

I am trying to find some way when using WP_Query of ordering by multiple meta_values. I know I can order by multiple values and I know how to order by meta_values but I cant seem to figure out how to ...
2
votes
1answer
2k views

order by numeric value for meta value

I have read countless posts on ordering data by numeric value ( as opposed to string - it i have a numeric meta value and it gets ordered like this 1 11 12 2 233 etc as opposed to the way i want it I ...
3
votes
1answer
288 views

Query two taxonomies via URL or link?

I've been banging my head about this, and have created a work-around, but it would be much nicer for my site's organisation if I could figure this out. I want to be able to query posts across two ...
1
vote
1answer
1k views

Sanitizing search data for use with WP_Query

I'm using heavily-customised WordPress to drive a fishkeeping website. I have two separate search areas: a site-wide search and a fish species search. The latter also has advanced search features ...
1
vote
1answer
438 views

Wordpress: Display posts by custom select query

I need Wp_query with two custom fields, one custom field for orderby and another: (if this key exists in the post so show the post else dont add this post to query.) I tried like this but doesnt ...
0
votes
1answer
384 views

Does using a custom query_var create a security hole?

Say I put the following code in functions.php function add_my_query_vars($qvars) { $qvars[] = "new_var"; return $qvars; } add_filter('query_vars', 'add_my_query_vars'); If somebody requests ...
0
votes
1answer
373 views

How to stack name list in non-alphabetical order?

an update on this: I managed to change from 'orderby'=>'title' to 'orderby'=>'date'as suggested. This almost made the order perfect except one clarinet that falls out of the order and is placed in ...
1
vote
1answer
575 views

Update Loop with Form

I have a photo gallery I'm developing using WP as a means for content management. I'm relying heavily on some jQuery plugins to manage the UI styling and manipulation (via sorting). My problem is ...
1
vote
1answer
2k views

WP_Query last five posts, simply ordered by meta_value

I can't believe I'm asking this question. It feels like such a simple method, yet I've poured over the WP pages and dozens of similar questions to no avail, so here it is... I've got a WP_Query with ...
0
votes
1answer
248 views

My class function is not seeing GET url paramaters

I have a set of variable set up, created with add_filter in my plugin functions file: add_filter('query_vars', 'user_country_var' ); add_filter('query_vars', 'user_lat_var' ); ...
2
votes
2answers
2k views

Get posts by meta data OR title

I have a working query that calls all my posts that have a certain meta value for one of two meta keys: $term = $_GET['term']; $args = array( 'post_type' => 'some_cpt_name', 'meta_query' ...
3
votes
1answer
6k views

Group WP_Query by category

OK, here's my setup: Custom post type called "issues" (for a magazine) Posts with custom meta field matching the post ID of the corresponding issue. When I'm on a single "issue" post page, I want to ...
-1
votes
1answer
109 views

294 Queries on Mainpage of Wordpress

I have 294 queries on my wordpress site. I checked using sql monitorand the maximum queries are to display count of a cities list custom field. Lets say there are 200 cities then 200 queries are ...
0
votes
1answer
59 views

Wrapping x posts in html without leaving empty html

So I'm trying to spit out unlimited numbers of posts for this wp_query, 6 at a time, each one being wrapped in <dd> so that it functions with my jQuery slider. The problem is, if I have exactly ...
1
vote
1answer
4k views

Getting all user metadata from user

I am trying to show bio and other custom metadata for my users in a page. So, i want to query the user metadata table for it. I have tried but did not find any functions for that. What i am looking ...
1
vote
2answers
1k views

Exclude the parent custom post-type posts only

Not sure if this is possible without some form of hard-coding but I have a custom post-type called 'city'. Within the 'city' post-type I have some parent post (e.g. England, America and China) and ...
1
vote
1answer
641 views

AJAX search posts and pages

Im trying to make a plugin where i need to create an AJAX search. Im using the method described in http://www.garyc40.com/2010/03/5-tips-for-using-ajax-in-wordpress/ to perform the ajax calls. So far ...
-1
votes
1answer
970 views

Getting Custom Field value in WP_Query

i am trying to display first post of 3 categs on my index page. so for that i wrote a little function as follows: function excateg($categ) { $recent = new WP_Query("cat=$categ&showposts=1"); ...
-1
votes
1answer
571 views

Query_vars not working for me

I'm trying to add an all pages link to posts when I have ?all=1 at the end of the URL it's returning "not set", I'm not sure what I'm doing wrong. I've looked here and my code is the same as here: ...
0
votes
1answer
131 views

Inefficient Query Confusion

Edit #3 - meta_keys as an array This seems to compare more than just the "opening_time" I can set the opening time for the wrong date or even leave it blank and it will still grab a post if the ...
-1
votes
2answers
2k views

Custom post type and have_posts() return empty result

I'm very confused regarding the have_posts(). It returns an empty result even though I have one post that match the query. The below code is used in a widget which should display exactly one post, if ...
1
vote
2answers
1k views

Very Slow Page - How to Optimize # of Queries?

EDIT 12/19/2011 Thank you again Ijaas. Everything is working except for the order of the days. It is ordering the groups of days by the publish order. If an older post has a newer date in its ...
0
votes
1answer
569 views

Display custom-post type based on the Title matching the current selected value

Ok quite a complex thing I'm trying to do here, and I'm a bit unsure how I will do it with wordpress, but I'm hoping some genius out there can help. I'm basically creating some comparison ...
1
vote
1answer
571 views

Filtering by Post Meta Custom Fields - Performance

I could use some advise on how to structure my data for performance. I have a custom post type with a lot of custom meta data stored in the wp_postmeta table as a serialized array under one meta key ...
0
votes
3answers
609 views

How to get pages of parent (non-recursive)?

I'd like to get all pages that are direct children of HOME_ID. Per http://codex.wordpress.org/Function_Reference/get_pages#Parameters (see 'parent' parameter), I think this should be done with ...
0
votes
1answer
661 views

Magazine style frontpage with multiple categories/loops and no duplicate posts

I am migrating a static magazine site to wordpress. I would like to have a frontpage displaying multiple categories with a few posts in each, e.g "politics", "environment", "health" and "technology". ...
-2
votes
1answer
288 views

How can I echo out the user id in user meta?

I need to generate a unique ID number for each new member. I was going to use WP_query, but am not getting anything but an array.
0
votes
2answers
515 views

Custom Post Type + Custom Meta Query Not Showing 2012 Posts

I created a custom "events" post type for a client that basically "hides" the post once it has expired (ie. the event already happened). The events are displayed in the order of the start date rather ...
0
votes
1answer
1k views

Custom Post Type Query W/Category Dropdown

I'm having a bit of trouble getting a custom post type query working coming from two drop downs. Let me show you what I'm using: The Form: <?php require($_SERVER['DOCUMENT_ROOT'] . ...
2
votes
0answers
489 views

Meta_query and numeric comparison [closed]

I have a WP_Query with meta_query filter on meta_value. if( ($capacity != '') && ($capacity > 0) ) $filters[] = array('key' => 'mb_capacity','compare' => '>','value' => ...
0
votes
1answer
302 views

How can I override one post and make it display content for another post?

I have two pages on my Wordpress site: mysite.com/?p=100 mysite.com/?p=200 I think I should be able to hook into Wordpress' actions somewhere and re-query the post, so that content for ...
0
votes
2answers
261 views

WP_Query and help with the loop for magazine front page

I'm having a difficult time writing out the PHP for this magazine layout I'm making. Here's the prototype: http://socalnpo.org Here's what I currently have: http://socalnpo.org/wp The first 3 are ...
4
votes
1answer
4k views

Meta Query with AND & OR?

I'm trying to do some filtering for some posts in WP_Query, but I can't seem to get the right condition. Basically what I wanna do, is get posts that have the custom field event_data (sorted by this ...
0
votes
1answer
593 views

Display upcoming events in the next 30 days by querying posts with timestamp in custom meta

I have a custom post type "event" which stores a custom meta as a timestamp ($event_date). The date is always in a dd-mm-yyyy format, so I can generate a unix timestamp from this key. The timestamp ...
0
votes
1answer
215 views

Modifying WP URL handing code?

I am trying to use mod_rewrite and modify WordPress' URL handling to allow for passing variables to PHP from the URL while maintaining "pretty permalink" functionality. (on WP 3.2.1) Something like ...
0
votes
1answer
434 views

orderby ignored by wp_query

With the following code, I do not get the result set ordered by titles. No matter what values I give to 'orderby' and 'order', I get the same ordering. The parameters seem to be ignored (or ...
0
votes
1answer
44 views

How can I change the term “Published” next to # of posts published on WordPress dashboard All Posts page?

On the posts page, there are a few columns listing types of posts with their corresponding number: All (#) Published (#) Trash (#) How can I changed "Published" to "Saved"?
10
votes
6answers
16k views

Wp get all the sub pages of the parent using wp query

Here is my code $my_wp_query = new WP_Query(); $all_wp_pages = $my_wp_query->query(array('post_type' => 'page','post_parent'=>$parid,'orderby'=>'title','order'=>'ASC' )); It displays ...
2
votes
3answers
1k views

post_type is ignored by WP_Query when 'tag' argument is included

I've created a function to call in a page template, inside of which is the following query: $custom_news = new WP_Query(array( 'post_type' => array('post', 'resource', 'job'), ...
0
votes
1answer
173 views

Multiple loops breaking side bar

Trying to put a bunch of loops in the side bar using WP_query. <div id="FL-pest-libray-sidebar"> <?php $category_query_string = new WP_Query(array( 'post_type' => 'page' , ...
1
vote
1answer
914 views

Custom Query num_rows returns wrong amount

So I have a custom query that fetches all posts in a given category. I am trying to get the number of rows returned but it is giving me the wrong number. Instead of 11, I am getting 14. Does anyone ...
0
votes
2answers
576 views

$post in wp_query?

How do I get the $post Variable in a WP_Query started loop? I have to get the excerpt, raw $post->post_content and further things. This is why I have to get Access to the Variable itself. How am I ...
0
votes
1answer
352 views

2 loops, is_home won't work, count is off

Alright, I've made a bunch of themes over the years, and I've written a lot of queries. And I just realized that I apparently have no clue how to get multiple queries to behave. So, here is the loops ...
2
votes
1answer
1k views

Using custom meta_query with relation not working as expected

I am trying to create a query to pull future events only. It was working great until the client requested the ability to add date ranges--so the event will either have a start date only, OR a start ...
0
votes
1answer
3k views

Displaying a specific post in a wp query by post id

I'm simply trying to display a specific post id from my custom post type 'homepage_video'. I'm sure that this is the correct code but it seems to be returning all of the posts rather than just Post Id ...
1
vote
2answers
1k views

How do I search inside specific taxonomies in Wordpress

I am trying to search for posts in specific taxonomies but any time I search, I get results from all the other pages instead of Wordpress searching within the selected category in the taxonomy. I ...
0
votes
1answer
383 views

Count of posts with meta_key filled in?

Working on upcoming events list that returns posts fine in a custom query. In the custom post type 'event' there are multiple events within a date range. I want to display all upcoming events in ...
1
vote
1answer
335 views

How do I reset this wp_list_categories query?

How do I reset a query that generates a list of categories with wp_list_categories? The query below builds a two column list of categories that is then displayed with the second code chunk. I'm ...
1
vote
1answer
330 views

Display upcoming Events for next 7 Days

I saw a request for a simple 7 day event calendar that always starts with today. I have a custom meta box called opening-time that gets a YYYY-MM-DD input. For now this is what I have, and its not ...