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

Multiple keyword search

I have a custom search where I want to enter a keyword or phrase into the search box, and then by pressing enter it adds it to a 'search storage' (already coded, see below). Asume I have 3 posts, one ...
1
vote
1answer
402 views

is there a way to show the the post title after the image?

Trying to show the post title after the image in the main blog page and single page, I have tried to edit the content.php but unable to achive the result I need, which is basiscally IMAGE TITLE META ...
0
votes
1answer
2k views

posts_per_page doesnt work

Here is the my custom query ; <?php $Poz = new WP_Query(array( 'posts_per_page' => 3, 'orderby' => 'date', ...
1
vote
2answers
430 views

Single page theme that uses pages for the content

I'm making a one page site. On the page I want to run WP_Query three or four times to pull in those 3-4 pages. The page looks a bit like this: <div class="row"> <?php $args = array( ...
0
votes
1answer
251 views

WP_Query search by multiple meta key and distance

I am having two meta keys, longitude and latitude, and what I am trying to do is the equivalent of the google store location algorithm for distance, in wp_query: SELECT id, ( 3959 * acos( cos( ...
1
vote
2answers
2k views

Pagination doesn't work in custom page template [duplicate]

Possible Duplicate: Pagination not working with custom loop Apparently this is very popular issue. There are already bunch of people offering answers for this. But somehow after hours of ...
0
votes
2answers
2k views

Multiple orderby parameters in pre_get_posts() action

Referencing @Otto's response to a question I also had about ordering by multiple fields, here is what he said: Can't do it with a naive WP_Query. Use the posts_orderby filter to add your own ...
0
votes
1answer
341 views

Widgets: Show Recent Posts Only if the Posts Have Both Categories X and Y

I've been trying to create a Recent Post widget where it only show/display posts that have both categories X and Y (or more). The categories X and Y is user-defined, so I'm planning to make it look ...
0
votes
1answer
182 views

how can I get seperate the HTML in the_content(); output?

I want to be able to seperate the first image form the post into a <div> tag and link it to the post page and be able to add html around the post text elements seprately. Any help is greatly ...
0
votes
1answer
40 views

Showing posts from 4 categories along with all latest posts

Currently in my theme i am running the default query that pulls all recent posts/latest entries/latest published posts . But i am looking for something more complex like i am gonna setup two sections ...
1
vote
3answers
1k views

wp_query for the first sticky, then display the rest of the posts excluding the first sticky

I've been reading this by @nacin and getting to grips with wp_query over query_posts that I used to use. What I want is: to put this in a template file to query all posts of this category, in this ...
1
vote
0answers
92 views

How to increase load time of an archive/search page (WP_Query)

I'm currently looking at why the archive and search pages take so long to use, and have found that the bulk of processing time is spent on the query_posts that is called before the template has even ...
0
votes
1answer
931 views

Display posts from Last 24 hours and order them based on most views

I am trying to display the posts of last 24 hours and order them by most views. I call the most views by this code: ...
2
votes
2answers
249 views

What is an efficient way to query based on post_meta?

The problem I am having is when I allow users to filter posts it overpowers the database and things run extremely slow. I am unsure what the best way to query posts using meta values is. My site has a ...
0
votes
2answers
183 views

WP_Query - meta fields numeric

I'm having trouble with the code below. Attempting to do a query against meta data stored with the posts, in the mls post type. I think I know what the issue is, but not how to fix it. I am ...
0
votes
1answer
61 views

How 'secure' are loops?

I am using loops as means of displaying personal meta and customer information on the frontend. For example, I have a page which displays a user's 'profile' information to edit. Their profile is ...
1
vote
1answer
183 views

Use query->set or make new query?

I'm writing a loop for multi post types with meta_key filters. The filters are inputs from visitors. When visitor click a link(filter), The form submitted and I get the filter. Now, should I just use ...
0
votes
1answer
679 views

Query Custom Post Type by Taxonomy

I've created a query working fine pulling posts from a specific taxonomy—but before I had only 7 taxonomies that were permanent, now I have sub taxonomies under that main taxonomy and they will be ...
4
votes
1answer
1k views

Register custom query args parameter for WP_Query()

I have written a plugin which can store a table of technical specifications for each post (product) in an own database table. For the search function of the site I want to add a custom parameter to ...
2
votes
2answers
209 views

Minimising number of queries on a page when using Advanced Custom Fields

I'm currently working on a site where there is extensive use of the popular Advanced Custom Fields plugin. However, as a result the page loading time can be quite slow, especially when using the ...
1
vote
1answer
309 views

WP_Query() returns null when results exist!

I really, really don't get it. On my archive.php and category.php it doesn't find any content. I know the correct templates are loaded, but WP_Query just don't find any content. This is what i've ...
2
votes
2answers
170 views

Author Page Custom Query WHERE author OR [post meta value] OR [post meta value]

I am currently trying to perform a custom query on the authors page (author.php). I have two custom fields for posts that I want to query against (post_photographer and post_videographer). What I am ...
0
votes
2answers
1k views

Sort posts by custom taxonomy name

Is it possible to sort posts (custom post type) by category / taxonomy (name, desc)? For example my categories would be Season 2012 some post some post some post Season 2011 some post some ...
0
votes
1answer
170 views

WP_Query Class custom field parameters

In the the class WP_Query, using the meta_query(array). The wordpress codex says that the 'value' is a string|array. The array support is limited to a compare value of 'IN', 'NOT IN', 'BETWEEN', or ...
0
votes
2answers
179 views

tax_query not working in template

I have a custom post type called 'product' with a registered taxonomy 'product-type'. I want to display all post from a particular taxonomy from custom post type. In my case I want to display all the ...
2
votes
4answers
488 views

Query Posts in a Predefined Order

I am using the query_posts function to list a 10 specific posts which lookup by post id. I have an array which looks like this.. Array ( [0] => 17983 [1] => 17932 [2] => 18030 ...
1
vote
1answer
108 views

Advanced Taxonomy Queries Wordpress

I am working with wordpress and business listings. I have about 5000 business listing all over the usa. Each business listing has a custom field for state, county and city and brands. My business ...
0
votes
1answer
731 views

Custom search form with empty parameters

I'm building a custom search form with keywords and drop down lists (categories, date, and country (have a separate plugin for this)). In the searchform.php I have the input field and then ...
1
vote
1answer
737 views

WP_Query Performance Issues with meta_query

I'm working on a custom template for a new theme that uses a WP_Query instance to select posts from 2 post types with 2 custom fields that are NOT empty. Depending on the section of the site, a ...
1
vote
1answer
288 views

Converting the_content string to an array?

I have created a custom taxonomy, this taxonomy is dedicated to image attachments, when I upload my images $post->post_content returns a string like: '[caption id="attachment_98" align="alignnone" ...
2
votes
2answers
107 views

Multiple instances of Featured Image Query

I have some custom code built into the header of my theme that gets the featured image from a post, displays the image and links to the posts permalink when clicked on by a user. The problem I am ...
-1
votes
4answers
902 views

Why is my WP_Query outputting my entries twice?

I am using a small shortcode to output a list of movie titles arranged by decades. decades is my custom taxonomy with terms like 1930s 1940s etc. Here is my shortcode: [fashionfilms ...
-1
votes
1answer
345 views

How to exclude certain portfolios from a loop

I am new to the site and have racking my brain on a Wordpress issue for days. Hope you the intelligent people here can help me figure this out. I have a page on my website that displays all my ...
1
vote
2answers
2k views

How to order custom post type by multiple custom fields?

How to display posts with 'Event' custom type ordered by 'Start_Hour' and then by 'Start_Minute'? 'Start_Hour' and 'Start_Minute' are numeric custom fields. I tried this, but it doesn't work: $args ...
1
vote
1answer
540 views

Sort users in get_users() in custom order

<?php $blogusers = get_users('include=5,6,2,7,12,8'); foreach ($blogusers as $user) { ... } ?> Right now these users will sort by first name. How do I sort this the order the numbers ...
0
votes
1answer
1k views

WP_Query class not found

The idea is simple. I have a drop-down menu generated with get_categories(). This outputs a list of categories in an unordered list, each in it's own li element. I'm getting the text values of those ...
2
votes
1answer
3k views

Can I query custom meta data through WP_Query

Ok, my question is a bit complex so I will try and give a general explanation and then go into details afterward. I am running WordPress 3.4.2 and I am using WCK Post Type Creator and WCK Custom ...
1
vote
0answers
295 views

How to filter a query by multiple meta keys and order by other meta keys

I'm trying to query posts using WP_Query and meta_query parameters: $args = array( 'post_type' => 'produkty', 'meta_query' => array( 'relation' => 'AND', array( ...
0
votes
1answer
174 views

Pagination in custom query not working [duplicate]

hi im trying to output pagination without any success. below is my code in a page-products.php template <?php $products_query = new WP_Query(array( 'post_type' => 'product', ...
0
votes
1answer
61 views

Order by meta values

I have 3 meta fields related to dates: year = 2012 release_date = 14 November 2012 release_date_db = 20121114 I need to show the posts from year 2012 sorted by release_date. I made this: ...
1
vote
1answer
173 views

Is there a reason why Pages are not publicly_queryable?

I am building a segmented search (by post type) with the ability to filter to a specific post type and realized pages were not publicly queryable. What I know I can do is the following: function ...
1
vote
1answer
232 views

WP_Query() and get_posts() can't handle over a thousand posts?

So I have a search function that just fetch custom posts and return them as a list. function search() { // post query args $args = array( 'post_type' => 'post_type', ...
0
votes
1answer
1k views

sort and display posts by custom field (wp-query and the loop))

i only want to show upcoming events posts on the homepage. i have made a custom field using the 'custom field suite' plugin, called 'ENDS' representing the date an event ends. as you can tell, i ...
0
votes
1answer
1k views

meta_query with array as value

I am writing some PHP which allows users of my site to submit a form and query posts by their post_meta. Everything works fine except for one thing, I used Advanced Custom Fields to create the ...
0
votes
2answers
71 views

how to retrieve WP_Query without ordering by date [duplicate]

Possible Duplicate: Orderby = none not working I want to use $query = new WP_Query( 'post__in' => array( 2, 5, 12, 14, 20 ) ) ); to retrieve posts by ID, I do and the result ordered by ...
0
votes
2answers
1k views

How to get post meta value and post in one query?

When query a post, I need not only the post but also the post_meta. But seems the post query and meta query can not be done together. With WP_Query, I first get the posts, then, I need to do ...
0
votes
1answer
859 views

Duplicate posts showing up in loop using infinite scroll

I'm experiencing an odd issue using Infinite Scroll for the WP_Query loop on my homepage. Half the time when the second page fires, I'm getting a few duplicate posts showing up in the second set. I ...
3
votes
1answer
298 views

How to Access Global $multipage or Global $numpages outside the loop?

I am writing a code in the header that pertains to link rel='prev' and link rel='next' thing but I need to check if the post is multipage. I check out these global variables: $numpages $multipage ...
1
vote
1answer
143 views

How to disable main query?

I don't use The Loop, because I use different queries to fetch posts (I use 3 queries instead of one). How to disable main query for home, category and search pages?
0
votes
1answer
703 views

get_query_var returns null

My pretty permalink clearly shows the query_var: localhost/site/?tree=312 Yet when I run var_dump(get_query_var('tree')); I get NULL returned. Any reason why? Also when I print_r($wp_query), I ...