"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

5
votes
1answer
76 views

IP address character limit

my client in his template is using <?php comment_author_IP(); ?> to display IP's of comment authors. Recently he came to me with idea of limiting whole number to several characters. Final result ...
0
votes
2answers
186 views

WordPress theme options error

I am building a theme and I need to call theme options But I do get errors like white screen and 500 internal server error when I call theme options here In WP query (newbie in PHP) ...
1
vote
1answer
255 views

Custom loop with multiple taxonomy queries

Apologies -- new to the stackexchange and actually posted this over in Stack Overflow because I didn't know there was a WP specific joint. My issue-- What I Have: I've got the code for a working ...
16
votes
3answers
2k views

Should I use Pre Get Posts or WP_Query

I have the following query which I call in my taxonomy.php template via query_brands_geo('dealers', 'publish', '1', $taxtype, $geo, $brands); This function works perfectly. However after reading ...
0
votes
1answer
432 views

Site not getting correct featured image from my query

On the home page of my site I have a series of tiles that link to various parts of the site. One tile links to the blog and I have written some code to pull the latest post with an image attached to ...
0
votes
2answers
113 views

Why won't my paged wp_query work? [duplicate]

Possible Duplicate: Pagination not working with custom loop Any ideas why this paged wp_query doesn't seem to want to work? I've tried replacing the pt_pagination function with the default ...
0
votes
1answer
463 views

Custom query (author is post_author or meta co_author) with Pagenavi pagination

I need to create a custom query for the author archive (where the author is post_author OR is a meta co_author), and it have to work with WP Pagenavi. The query is something like this (omitting $wpdb ...
1
vote
2answers
432 views

twentyeleven_content_nav hook no longer outputs navigation link after 3.5 upgrade

After upgrading to 3.5, I discovered that navigation has disappeared outside of the main index page. Theme is TwentyEleven and I've verified that this still occurs after disabling all plugins. ...
3
votes
1answer
121 views

Excluding posts from a category but only if they're not in multiple categories

I am looking to exclude a category in Wordpress. I am referring to the Wordpress Codex page on wp_query but I am having the following problem: I want to exclude posts from category 1, but if a post ...
0
votes
1answer
258 views

How to add a recent post function to a text widget I created for practice?

I am currently being trained to create widgets and my mentor has asked me to create a text widget then add the ability to display the 5 most recent posts (all categories) on it. I am a little stumped ...
5
votes
1answer
4k views

How do I use WP_query with multiple post IDs?

I want to query multiple posts with an array of IDs (note: I am querying a custom post type). Here's what I have, which isn't working: $myarray = array('144', '246'); $args = array( 'post_type' ...
1
vote
1answer
243 views

Too many posts cause slow load when paginating

I have about 10k posts and I made a page that lists all posts but it is paginated every 54posts. It gives 131 queries in 6.730 seconds which is pretty slow to load. Is there a way to make it load ...
0
votes
1answer
224 views

Only display posts that are in multidimensional meta_value

So i want to retrive a list with the posts that are in the meta_key "_blocks" and in that there is a multidimensional array with "areas" called left, right ,top etc. And within them there are assigned ...
0
votes
1answer
33 views

Assign a tag to custom post type using a query

I have a custom post type courses with a custom field level. I want to run a query (mysql or WP query) that runs through every course (post) and if the level is greater than 3, append a tag called ...
0
votes
2answers
683 views

Select custom posts by meta_value and sort by a different meta value

I have my query set up like this: $article_query = new WP_Query(array( 'meta_key' => 'issue', 'meta_value' => $post->ID , 'post_type' => ...
0
votes
1answer
57 views

wp query problem

I am using wp-postviews plugin to to track views of my post The author provided a query to order post by views in index.php <?php query_posts('v_sortby=views&amp;v_orderby=desc') ?> ...
0
votes
1answer
126 views

querying posts by custom taxonomy terms right from a querystring based URL

The following URL seems to work for cats and tags only. yoursite.com?cat=2&tag=bread1+bread2 what if you wanted to get into custom taxonomy and terms and do something similar? is there an ...
0
votes
1answer
177 views

Can I make a search query which includes a space?

I want to search via WP_Query for the test "hello " including the last trailing space. Is this possible and if so, how do I do this?
0
votes
1answer
535 views

Add a default meta_value to new posts

I have a page template that allows users to create and update posts from the front end. I also am using 2 plugins, 1 that allows the user to rate posts from 1-5 stars and another that allows them to ...
0
votes
1answer
294 views

Using multiple variables to assign categories to an array

I have php set up in a template file to check a form and see if 1 or more of 5 categories is selected. Based on which one is selected, I want the custom query I'm using to change in that the array for ...
1
vote
1answer
1k views

Ajax and WP_Query/tax_query parameter

After doing some extensive research, I've exhausted all my options and decided to actually ask a question here. I'm trying to get a filtered set of posts through AJAX using WP_Query and the tax_query ...
0
votes
1answer
206 views

Wordpress Queries Not Working?

//Display All Reviews function display_all_reviews( $query ) { if ( $query->is_home() && $query->is_main_query() ) { $query->set( 'tag', 'reviews' ); } } add_action( ...
0
votes
1answer
179 views

Pagination not working on homepage

I tried multiple solutions but its not working. When I go to /page/2, it doesn't work. I'm executing custom query in index.php of my theme. if ( get_query_var('paged') ) { $paged = ...
4
votes
1answer
4k views

Nested meta_query with multiple relation keys

I am curious whether Wordpress is able to run nested meta_query, with each having different relation keys? As of Wordpress 3.0, tax_query is able to perform this function; I'm wondering whether this ...
0
votes
1answer
104 views

Show posts containing or not custom field

I'm trying to show aditional posts in the author's page. This page must have posts containing a specific meta_key and meta_value, where the displayed author it is not really the WP post's author. ...
1
vote
1answer
1k views

Post_count only shows the number of results per page

I have a wp_query $wp_query = new WP_Query($args); but for some reason the $wp_query->post_count only shows the amount of posts on each page. So if I set 'showposts' => '10' and 12 results are ...
0
votes
1answer
347 views

WP_Query meta compare must include ALL array values

I am allowing users to query posts using a form with checkboxes. I want the posts to be filtered by the checkboxes but instead of showing all posts that include the ANY of the meta values selected I ...
0
votes
1answer
154 views

Get next post when using pagination with WP_Query?

How do i specify which "page" to get when using WP_Query? I'm using pagination and i only display three posts per page, but i need to manually set which page to get, because Wordpress doesn't do that ...
0
votes
0answers
21 views

How to order posts by taxonomy in WP_Query [duplicate]

Possible Duplicate: Using wp_query is it possible to orderby taxonomy? I have a page template that should show CPTs grouped by taxonomy. I'd like to get all the CPTs in a single query and ...
0
votes
1answer
102 views

Query posts by custom fields

I am making a theme for a hotel, and I need to be able to provide functionality to search by the following custom fields: Location and Price. I need to be able to query them from the query string ...
0
votes
2answers
135 views

Determine if ID is page or post and query the ID

I want to look up a page id and determine if it's a page or post. Then query that id and display stuff like title, featured image, etc. This works for Pages: query_posts('page=' . ...
2
votes
3answers
420 views

What are the differences between “Latest Posts” and “Static Page”?

WordPress has an option to pick "Latest Posts" and "Static Page" under "Settings" in Admin Panel. My questions: What page template is getting loaded in each of those modes? Why paged stops working ...
1
vote
1answer
2k views

Using WP Query to search by multiple meta fields

I made a custom search form with select boxes and text fields. I have a select box with options like "renting" and "selling" (its a real estate site) There are also input fields for minimum and ...
0
votes
1answer
105 views

Loop posts without any taxonomy

I've grouped my pages by some custom taxonomy. But I need to care about those without any taxonomy set. My code is: $page_groups = get_terms('page_group'); //get all existing page groups foreach ...
0
votes
1answer
78 views

Get WP_Query query after execution?

It it possible to get the configuration of a the latest called WP_Query? I need to use it for debugging. For example, if i run something like: $the_query = new WP_Query( $args ); ... Could i get ...
0
votes
1answer
436 views

WP_Query -> sort results by relevance (= most tags / taxonomy terms in common)

I'm trying to write a new "related posts" widget (for the single post view) for my custom post type, filtering by custom taxonomy terms that the related posts should have in common with the current ...
1
vote
2answers
1k views

Modify WP Query post__in before have_posts()

I have a plugin that is returning post IDs based on $_GET data (which searches a secondary DB table). I am attempting to hook into the standard have_posts() function called within a taxonomy page to ...
3
votes
1answer
722 views

Querying post from a multisite network

I am working on a multisite blog network where I have to display recent post on my home page, 10 post per page navigation. I did implement it using wpdb object with one complex sql statement. I got ...
0
votes
1answer
121 views

Make Next and Previous on single-$posttype.php use the same order as archive-$posttype.php

I have a custom post type events and am displaying these events using archive-events.php and single-events.php from the template hierarchy. I have a custom query in archive-events.php $paged = ( ...
0
votes
3answers
548 views

Sidebar limiting to 10 posts?

I have the following code inside my single.php page: UPDATED CODE <?php if (have_posts()) : the_post(); $post_id = get_the_ID(); if ( is_single() ) { $cats = get_the_category(); ...
2
votes
2answers
3k views

Using a custom WP_Query with get_template_part loop

I have a query for a custom post type: <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $books = new WP_Query(array( 'post_type' => 'wiki', 'posts_per_page' => ...
3
votes
1answer
2k views

Get posts with tag all post types

I'm trying to get all posts that have a specific tag, regardless of what type of post that is. I've tried every solution I've found (here on SO and further), but nothing works: I always only get the ...
4
votes
1answer
243 views

Enforcing canonical URLs with multiple custom post types

I'm working on a project with several custom post types, where one of the post types is naturally (but not actually in the WordPress sense) the 'parent' of the others. For example, say I have a ...
1
vote
1answer
175 views

Custom Order in WP Query

I'm trying to implement my own query ordering, here is what I came up with... $query = new WP_Query('post_type=contentboxes&include=' . $contentboxes . '&order=ASC&orderby=include' ); ...
2
votes
1answer
235 views

List the 5 most recent child pages

I created a hierarchical custom post type for a gallery. The parent pages are the galleries and the child pages are the albums. I want to display the most recent albums on my sidebar (so basically the ...
0
votes
2answers
496 views

How to sort queried pages by an array of page ids?

I'm creating a one page wordpress website, and I need my 'home', 'about', 'portfolio', 'services' and 'contact' pages to all be on my front page. I created the following page template for my front ...
0
votes
3answers
339 views

How to check the array values, what WP_Query has brought to me?

I have two questions in a row: How to check the array values, what WP_Query has brought to me? If I get 10 posts in cat=3, then I want to get only 5 from them, and then want to echo them ...
0
votes
1answer
378 views

WP_Query post at custom position

Lets say I have a custom query which based on two custom post types: $wp_query = new WP_Query(array( 'post_type' => array('post-type-1', 'post-type-2'), 'post_status' => ...
0
votes
1answer
95 views

Making a Custom Post Type Publish Loop

I want to re-publish all previously published products of a custom post type. Let's say the post type is "events" This is what I was thinking something like this: $args = array( 'post_type' => ...
0
votes
1answer
1k views

Search another database with wp_query using new wpdb

I currently have a simple wp_query search working on my wordpress site. I now want that same search to look for results in it's own database and another one on same server. I found that I could use ...