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

How to use WP_Query in a CPT achive page?

I can't get WP_Query to work in my custom-post-type archive page. Can someone please tell me what I'm doing wrong? I would appreciate any help. Here's the code in archive-bulletin.php: <?php ...
0
votes
1answer
142 views

Cant' Display Custom Post Type Title Base on Tax Terms

Trying to list all Custom Post Type titles based on filtered Custom Taxonomy Terms I am getting the list of all post titles instead of getting the list of Queried post. Here is the code I am using: ...
0
votes
1answer
318 views

Problem with is_tax in WP_Query loop

The code below is the 2nd of 4 loops in "page-balls.php". Everything else is working correctly. I'm trying to display a tennis ball graphic if the post being retrieved has a the term "tennis-ball" ...
7
votes
1answer
3k views

Multiple relationship for multiple tax_query in WP_Query

I want to use the WP_Query class to filter some of my posts. The problem I facing now is handling the taxonomy query. Normally, the wp_query only handle one relationship for tax_query (either AND or ...
0
votes
1answer
170 views

WordPress | WP_Query does not return anything with s=a

I have the following code: $data = new WP_Query('s=a'); and the print_r returns the following data: WP_Query Object ( [query_vars] => Array ( [s] => a ...
1
vote
2answers
604 views

Next/Prev posts on same page

Hello WordPress Users, I'm stuck with a problem building my wordpress website and I can't figure out what to do about it. Currently I'm showing 2 posts form the category 'News' at the page 'News'. ...
0
votes
1answer
327 views

WP Paginate not working properly

Im creating a WP for a custom type post in a page template: <? global $paged; global $notquery; $temp = $notquery; $notquery = ...
1
vote
1answer
38 views

Query “Category A” + 1 post from “Category B” - how?

It's pretty easy to query posts from one category but what if I need also one single post from another category? $query = new WP_Query( 'cat=4' ); I'm looking for something like this: $query = new ...
0
votes
1answer
125 views

WP_Query calls all posts?

I have this code that picks a random testimonial post. <?php $quote_args = array( 'post_type' => 'post', 'category' => 'quote', 'orderby' ...
2
votes
1answer
650 views

Gravity Forms field entries into wp_query loop [closed]

I have a simple function that filters the page content when form (ID 18) is submitted. It simply displays the entry of field (ID 13)... add_action("gform_after_submission_18", "set_post_content", 10, ...
0
votes
2answers
3k views

How to apply filter inside a single wp_query?

I've got a special query on my homepage that returns posts from a custom taxonomy. I'm trying to apply this filter for it. add_filter( 'post_limits', 'my_post_limits' ); function my_post_limits( ...
0
votes
1answer
102 views

What is wrong with this wp_query?

I need to query posts by two meta fields and the wo_query I'm doing it with is returning nothing. Obviously, it's broken. Can somebody tell me what I'm doing wrong? $args = array( ...
1
vote
4answers
2k views

Get count of custom post type created by current user

I'm trying to get the count of published posts in a custom post type for the current user (to display on a profile page). I found this here on the forums: <?php global $wp_query; $curauth = ...
0
votes
1answer
114 views

Exclude an array

I'm moving edit post dashboard to front end. So here is a case, I have to queries, one for product attachments and other for ALL. Now, I want to exclude product attachments from ALL attachments query ...
0
votes
1answer
78 views

Randomly pick one testimonial post

I want to show one randomly picked testimonial on a page. Each testimonial is a post with a category of 'quote'. Each post has a custom field named 'who' with a name. I'm trying to use this code. ...
0
votes
1answer
188 views

WP_query exclude a category unless it has more then one catagory

I have this category exclude_cat with id 39 I want to exclude it from the home. So I use for WP_Query args like this: $args = array ( 'category__not_in' => array( 39 ), //exclude ID ); Works. ...
1
vote
0answers
70 views

How to output topics and replies in bbpress as table?

I need to output the bbpress topic and reply loop in a table format. I'm having trouble finding how one might do this Are there any suggestions on how one might do this? Can this be done using ...
0
votes
1answer
491 views

wp_dropdown_pages with tax_query clause

I'm display a dropdown list of custom post types in wordpress. This first block of code uses WP_Query $houseQuery = new WP_Query( array( 'post_type' => 'house', 'order' ...
2
votes
1answer
1k views

How to get first post in a category of a custom taxonomy

I'm attempting to make a list of categories bound to a custom taxonomy, but using the featured image of the first post in each category. Getting the categories was simple enough, but when I try to ...
1
vote
1answer
827 views

WP_Query with ajax handler returns the same posts

I have a problem that is getting me bald atm. I have a ajax call that handles a loop that handles some querys and returns posts for me. So far so good, but the first time the user sees the page we ...
0
votes
1answer
98 views

Query for first 3 posts to change the look and feel

Is there a way to query for the first three recent posts and then change how they display on the front page? I want the first three posts of my blog to show differently than the rest of them i.e. ...
0
votes
1answer
310 views

WP_query multiple custom fields not working

I am currently using WP 3.1 and trying to get WP_QUERY to work with the custom fields. My argument is as follows: $args = array( 'post_type' => 'post', 'meta_query' => array( 'relation' ...
0
votes
2answers
3k views

How to get only ONE category of “Portfolio” posts to display on main page rather than ALL categories?

I have a section on my main page that displays a new “Portfolio” post each time I write one no matter what category I assign them to. What I want to do is make the main page only display one specific ...
0
votes
1answer
189 views

Better wordpress attachment query then this

I have a site with more then 10.000 posts and images, its classipress site. I need somehow to show all images from posts that are on pending status, and who havent expired(post meta). This is the code ...
4
votes
1answer
2k views

Changing the meta_query of the main query based on custom query_vars and using pre_get_posts

I've registered custom rewrite rules and query_vars to use for displaying a list of events based on ISO date format. For example when a user requests the URL, http://site.com/by-date/2013-04-04/, my ...
0
votes
1answer
127 views

Cache issue with WP_Query and custom field filtering

I have three separate WP_Queries on a page. Each of them return custom post type items that have a certain checkbox checked and then display one of those randomly. The checkbox has been added using ...
1
vote
1answer
1k views

Select from wp_post and multiple meta_value from wp_postmeta

My lack of SQL skills has stopped me in my tracks here. I'm trying to select post_id, post_title and two postmeta values - the first has the meta_key of 'search_country' and the second a meta_key of ...
0
votes
1answer
86 views

Custom loop won't work, can't find problem

I can't figure out why this custom loop isn't displaying for me:. I've tried removing the if statement and removing certain query parameters but it just won't display. If I delete the loop entirely ...
2
votes
2answers
430 views

Query for posts in 2 taxonomies

I am currently using the following code to display a list with links to posts in a specific CPT and taxonomy: <?php $custom_terms = get_terms('videoscategory'); foreach(array($custom_terms as ...
0
votes
1answer
517 views

Posts of specific category on page and excluded from index.htm

hope things are going well. I'm trying to create a member's only section specific for posts of about job opportunities. My goal is to have posts of this category displayed on this page and excluded ...
0
votes
1answer
196 views

wp_query select if have comments

I previously asked and accepted a similar question here: wp_query and comment_parent - select only posts with top level comments So I'm trying to use wp_query to select only posts that have comments. ...
1
vote
1answer
986 views

When tax_query used, results disappear (0 =1 produced)

I'm trying to perform a dynamic query that uses a dynamically passed taxonomy and post_type, and displays results accordingly — A user makes a selection from 3 drop-downs on a form, each have a ...
0
votes
1answer
227 views

How to extract images of post and pages excluding header and logo image in wordpress?

I have tried this code to get all images from media library and i am sucessfully getting the source urls of all the images but now i want to exclude all the unwanted images like logo, header images ...
0
votes
2answers
204 views

How to find what index page a post is on?

Here is a simple example of what I am wanting to figure out. Say I have WordPress set to show 5 posts per page. And say I there is a post 17 posts back chronologically. The formula would be 17 / 5 ...
0
votes
1answer
463 views

Custom post-type's pagination not working in category.php

I have this code to the file category.php : <?php get_header(); ?> <div id="content"> <div id="all"> <div id="todo"> <?php $my_query = null; $paged = ...
1
vote
0answers
90 views

Meta Query And/Or

My question is very similar to Meta Query with AND & OR? . This question was answered in 2011 by @Otto. With the exception that my logic is different. I want to query, for example, posts with ...
0
votes
1answer
285 views

Custom query shows custom post types in trash

I have a custom wordpress query like so: $query = new WP_Query(array('post_status' => 'future || publish', 'post_type' => 'kalender', 'order' => 'ASC')); But the problem is that the items ...
0
votes
2answers
112 views

Create a Blog Template Page

I am trying to create a template that will display a list posts of a specific custom type. However, I am missing something fundamental. So far, here is what I have: functions.php add_action( ...
1
vote
2answers
149 views

Why is the first query affecting the second query, even after wp_reset_query() and wp_reset_postdata(), but not on the second page?

I am literally clueless as to why the code does not function properly on the first page, but functions as expected on the second page. I have already tried running the second query via another ...
0
votes
1answer
763 views

filter posts by meta key with pagination

Trying to filter out specific posts that have certain meta_key from the main query... problem is it doesnt work with pagination which is my issue here. Anyone knows how to solve this? $paged = (end( ...
0
votes
1answer
708 views

Fatal error: Allowed memory size exhausted

I have a custom .csv generator functions that basically export data from posts and its post metas. The function works fine on this WP_query parameter: Array( [tax_query] => Array ( ...
0
votes
2answers
695 views

Post Type => Any conundrum

I have a number of regular posts and pages in a regular category called "Featured". I have also installed a plugin called "Event Organizer" that creates its own custom post type called "Event" and has ...
4
votes
1answer
359 views

How can I save an array from a random post sequence for later use?

I'm building a random workout generator on Wordpress to help with my fitness, and am stuck at saving random post arrays for later reference. I'll explain. The generator should work in two main ...
0
votes
1answer
350 views

Custom loop of a single category, cannot order by date. What am I missing?

I'm going nuts. All I have is a simple loop on the home page of the site (which is a static page), and it should show the most recent (1) post of a certain category. The trouble is no matter what i ...
0
votes
1answer
85 views

Dynamically change post_parent in every page load?

What's the correct Wordpress action where I can hook to dynamically change the post_parent of a post? I understand that a post can't have multiple parents so that's the only way I can think of to ...
0
votes
1answer
218 views

Query specific number of posts for each post type in specific order

This is related to this other question, I tried with get_posts, pre_get_posts, WP_Query and basically every option I could find for 2 days now, no solution yet. The full problem in hand: I have 2 ...
0
votes
1answer
87 views

Determining what post is displayed out of total posts found

On my page I've got a query that retrieves posts with specific parameters and I'm displaying one post per page with pagination. I've figured out how to get the total count of posts found by the query. ...
0
votes
1answer
579 views

WP the_posts() on single-cars.php get category link

I have a custom post type called cars. There is a taxonomy brands. I have a template single-cars.php and I'd like to add a link to the brand page(The category). Assume I'm on the page of the post ...
2
votes
2answers
161 views

How to query different post types in specific order?

I have 3 posts types, articles, news and tips. On the home page I want to query 20 posts in this order: article, article, news, news, tip, ...// same order again until 20 If I use a custom query ...
0
votes
1answer
228 views

Query Problem - Show posts within category 'x' that have a custom field between 'y' and 'z'

I'd like to display all posts within a given price range. For example: When a user inputs 100 and 1000 (in two separate form fields) - my site will display all posts that have a custom field called ...