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

Delete data from custom table when deleting a post

I want to delete post id form my custom table, when deleting a post. I have tried this way, nothing happened. Please help. add_action('delete_post', 'delete_data'); function delete_data($post_id) { ...
1
vote
1answer
109 views

Reverse chronology of post listing

I"m working on modifying a theme that is based on 2010. I want to make the posts on this blog display earliest to oldest, but I don't see how to do this in the theme: I understand I need to add . ...
2
votes
1answer
2k views

WP_query : meta_key with custom rule for specific value

I'm a bit stuck with a WP_Query code. Here it is : $args = array( 'post_type' => 'post', 'meta_query'=> array( 'key' => 'karma', 'compare' => '>=', ...
1
vote
1answer
27 views

If Query In Sidebar

I'm trying to create a query that IF there is a value in the 'FeaturedQuote' custom field, then this shows <h3 class="featuredquote"><blockquote><span ...
1
vote
1answer
258 views

Mysql query and order meta value

I made a mysql query to WordPress like this: $querystr = " SELECT $wpdb->posts.* FROM $wpdb->posts, $wpdb->postmeta WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id AND ...
0
votes
3answers
48 views

Is there a way to make this kind of loop shorter and nicer?

Here is my loop code, i want to call different page templates for different pages. Please notice that this is a one-page-layout. <?php $args = array( 'post_type' => 'page' );?> <!-- get ...
-4
votes
2answers
2k views

How can I display sticky posts at first in wp_query?

I'm looking for a long time, but I could not find a solution. I'm not a coder. Please help me. Here is my wp_query code; $my_query = new WP_Query('category_name=animals&showposts=10'); while ...
0
votes
1answer
378 views

Insert data in custom table during new post creation

I want to in insert data in my custom db table when creating a post. Suppose there are three categories (php, wordpress & jquery). When i create a post in wordpress, i want to insert post id and ...
0
votes
1answer
541 views

How does Show Posts based on a keyword search work in WP_Query

I am wondering how the search go through by defining 's' parameter in WP_Query. For example if I have a post assigned to "East" term in taxonomy "Direction", the post didn't mention any "East" or ...
1
vote
1answer
870 views

Combine two taxonomies in a hierarchical tree

For example, I have WooCommerce products that have taxonomies: brand (e.g. Converse, adidas, D&G) (taxonomy id: product_brand) category (e.g. Boots, Sneakers, Sandals, Heels) (taxonomy id: ...
0
votes
0answers
340 views

Query recent posts by author

I'm fairly new to wordpress but trying to get recent posts by a specific author. The following code displays only most recent bog posts. I am using a custom field to get the author ID. EDIT by ...
3
votes
2answers
848 views

How to prevent execution of default query, while preserving ability to use WP_Query in template?

PROBLEM: I'am trying to prevent execution of default WordPress query for custom category template. I have found a possible solution, but looks like it preventing execution of all post queries: ...
1
vote
1answer
146 views

WP_Query returns more results than expected

I've written a query that is supposed to return all attachments called "no-image" (is part of a function that handle images fallback when there isn't a featured image), the if I get some result, the ...
0
votes
1answer
1k views

wp Query Posts to display in Nivo Slider

i have coded a slider into my wordpress theme to use query posts to display the thumbnail and the content however it appears that its displaying the whole posts? and not just the one relating to the ...
1
vote
2answers
135 views

Trying to find a way to query post like normal search would do. within search.php page

I have a costume search in a site i am making. When a user search a certain term, i want to display category list with a count of how many posts are found with in that category. I thought of a way ...
2
votes
1answer
105 views

Filter WordPress posts by between parameter

How to filter WordPress posts by a taxonomy and between parameter? Consider a mobile website with "memory size" taxonomy, I need to show posts that have more than 256 mb memory and less than 768 mb. ...
0
votes
1answer
1k views

Display products from specific category in shop page

I know many people asked for this question but I didn't find a proper way to do it. How to add a simple meta_query (product_cat) before the execution of the shop page's query. Maybe by using a filter ...
2
votes
1answer
1k views

add_filter and remove_filter added before and after wp_query

I have just started with WordPress Development, and found following block of code online (in some tutorial) function filter_where( $where = '' ) { // posts in the last 30 days $where .= " AND ...
0
votes
1answer
88 views

Display posts from a category

I am trying to display a bunch of posts from a single category on the category page, using multiple loops. <div id="featured-content" class="clearfix"> <? // assign the variable as current ...
0
votes
1answer
150 views

next_posts_link returns same content of 1st page

Pagination seems to work fine... I have 21 posts... and it will go to 3 pages... however... every page shows 10 posts and the same content as the first page.... <?php $temp = $wp_query; $wp_query= ...
0
votes
2answers
436 views

Custom search: Search posts but display parent page in results

I'm using Wordpress 3.5.1 with a modified twentytwelve theme. My main site structure is based on the Smooth Slider plugin (jQuery Cycle). I have Pages that contain only a shortcode (for example, ...
0
votes
1answer
235 views

Highlight post in sidebar on single page

When you have a menu for say pages, it's easy to highlight your current page, since WP puts a class on it. But what I have is a sidebar with the 20 latest posts in a loop and a separate main content ...
2
votes
1answer
363 views

Can you order posts from wp_query by two custom meta fields?

I'm working on a site that lists events. Right now this query lists events by date: $args = array( 'post_type' => 'espresso_event', 'post_status' => ...
0
votes
1answer
88 views

404 on Pages for Custom Post Type & Query_Posts

It took me quite a while to find a good solution for ordering a custom post type by two custom meta keys. When I finally got it working, I found out the pagination no longer works. I've tried dozens ...
0
votes
0answers
113 views

Custom Post Query Combined with Conditional Tags

Is it possible to combine displaying a list of custom post types on a single page depending on conditional tags? Below is what I have so far, basically if there are 4 posts or less show the posts, if ...
1
vote
1answer
551 views

creating wp query with posts with specific category

Im running a specific wp_query to show the thumbnails in a slider of a specific category. <?php $the_query = new WP_Query ('showposts=2', 'category_name=Events'); ?> This doesnt appear to be ...
0
votes
1answer
26 views

Finding a post's slug

I'm using wp_query() to get custom posts from the database. I want to list these out as links to the entries, so I'm thinking I could use the slugs. Sadly these don't seem to be included in the ...
0
votes
1answer
95 views

WP_Query in a shortcode

I am trying to put several queries in a shortcode so that I can call them in a page instead of using custom templates. I got my query going but I only see some of the content on the page. The image ...
0
votes
1answer
445 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
136 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
299 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
167 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
558 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
299 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
119 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
587 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
2k 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
97 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
112 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
72 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
184 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
64 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
458 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
741 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
90 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
293 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' ...