"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
1k views

How to do a particular wp_query taxonomy search

I have added a custom taxonomy called experience to the page post-type, and the taxonomy has terms "vfds" and "plcs" I am trying to create a search where a user can select one or more experience ...
1
vote
2answers
837 views

Using Query Posts With Multiple Post Types And A Taxonomy

I am developing a site that has two different custom post types; one of them is called Articles and one is called Sketchpad. Sketchpad is user submitted content that is assigned a custom taxonomy term ...
1
vote
2answers
1k views

How do I make a meta_query OR relation work? [closed]

Here's are wp_query args: $args = array( 'post_type' => 'sportpages' ,'post_status' => 'publish' ,'posts_per_page' => 1000 ,'post_parent' => 4738 ,'meta_query' => ...
1
vote
1answer
267 views

switched from query_posts to WP_query, not working now?

So I had asked (in retrospect a pretty non-question) at A little help/cleanup from a real coder? and one of the comments was to not use query_posts and instead use WP_Query. So I did a little digging ...
0
votes
2answers
2k views

get query's query string

By the time index.php runs, it seems as though there is already a query populated. How can I find out what that query's query string is? eg. new WP_Query([query string is here])
0
votes
1answer
26 views

query inside main query order issue

I'm trying to access the following shortcode in a simple page, with [featured/] function mytheme_featured() { $my_query2 = new WP_Query('category_name=featured&showposts=1'); while ...
0
votes
1answer
62 views

WP_Query with 2 genres

I'm working with a custom post type and trying to get a query working that includes 2 genres (a custom taxonomy). I have this, which works for a single genre (I don't want to display the widget ...
0
votes
1answer
434 views

wpquery via ajax

I can reload my page and have php write a new wpquery and replace the content on my page, but I really don't want to deal with a new page load. Is there an easy way to send a wpquery string (eg "p=7") ...
1
vote
1answer
3k views

How to query for most viewed posts and show top 5

Here is how I am getting the views for one post: function getPostViews($postID){ $count_key = 'post_views_count'; $count = get_post_meta($postID, $count_key, true); ...
0
votes
2answers
88 views

Custom query does not find pages

I don't consider myself to be a newb, I've had a loop of all the pages work before, but right now one of my custom loops on my page template (which is used as the index page of the site), will not ...
3
votes
1answer
479 views

Want to redirect if search query match exact title of any post

I am using WordPress 3.3.1 and new to this system. I want to redirect the search query to the post if query exactly matches post title of some post. I also want it to run before any search query ...
2
votes
1answer
4k views

“tax_query” parameter not working with WP_Query

I have a custom post type called 'episode'. Attached to 'episode' I have a custom taxonomy called 'video_type' that contains two terms: "bonus-footage" and "episode"; "episode" contains two child ...
0
votes
1answer
890 views

Multiple loops on index page with sticky post and pagination

First post on this site. Hope to get some help from you guys. Probably a simple answer for you experts. I have two category's (news & work). I want to show on my index page (wordpress ...
0
votes
1answer
353 views

Deleting terms from the Wordpress wp terms table

what wp function do i use so that I can delete a term without worrying about the related tables such as wp term relationships and wp term taxonomy? Also if a post has a relationship to the deleted ...
0
votes
1answer
389 views

query_posts, oderby meta_value & print “future” posts

I have a custom post type for a cycling club uses to schedule rides. There is a custom field for these posts where the user selects the "ride date" with JQUI date & time picker. This information ...
0
votes
1answer
2k views

Display posts from an array of ID's

The result of the query so far is the print of the array, Array ( [0] => 309 [1] => 10 ), 309 & 10 are the correct id's of the posts I want to display, and "No posts were found" the result of ...
0
votes
1answer
261 views

Custom WP_Query breaks default behaviour of viewing right post associated with tax-term!

I have a custom-taxonomy for a custom-post-type just like categories. I've used the standard loop in my taxonomy-event_type.php template so far … if ( have_posts() ) : while ( have_posts() ) : ...
0
votes
1answer
294 views

Does wp track views for posts?

I want to do a query and sort posts by views. Is this possible? I'm not even sure where to start..
0
votes
2answers
370 views

Loop to fetch 3 post_thumbnail instances from 3 most recent custom post types named “portfolio”

I am trying to display 3 post_thumbnails from a custom post type "portfolio" on my homepage template. So one from post 'A' , one from post 'B' and one from post 'C' The image from post A will be set ...
0
votes
1answer
829 views

Pagination problem by using WP_Query

Sorry for me, if I use incorrect words or sentenses, my English is poor, i.e. I'm from Russia. I have problem with pagination by using WP_query and pagination links like next_posts_link and ...
0
votes
1answer
245 views

exclude pages in custom menu

I am creating a custom theme for wordpress, which will have a settings page. i am adding the option to exclude pages from the navigation, which will simply work on the page id separated by a "," here ...
3
votes
1answer
215 views

Sanitation needed for WP_Query or get_posts calls?

Just wanted to get a straight answer on this: when submitting query_vars to a call to get_posts or WP_Query, is sanitation needed or does WordPress already take care of that?
7
votes
1answer
1k views

WPML with WP_Query serving up all 3 languages

I've got something about this on the WPML support forums, but I figured I could ask here as well. Here's the important info: I'm running a WP Multisite setup with custom post types, custom fields, ...
0
votes
1answer
888 views

Category 'pad_counts' & 'parent' conflict

Below is the current loop I have setup: <?php //start products category loop $args = array( 'hide_empty' => 0, 'parent' => 0, ...
0
votes
2answers
216 views

Get all custom_post_type posts + blog posts from one category in a single query

Is there a way to query posts from multiple post_type's and filter the normal blog posts by a category? I am trying to display the 10 latest custom_post_type posts and blog posts on my homepage in a ...
0
votes
1answer
675 views

Is it possible to create a shortcode that will query a post based on taxonomies?

I am working on a site that will be listing a few hundred products and we wanted to be able to quickly/easily show specific products on a page based on taxonomies. I have been doing some research and ...
2
votes
1answer
879 views

wp_query custom post type by taxonomy & standard post by taxonomy

Anyone know how I can neatly combine a query to pull CPT by a custom taxonomy and also standard posts by taxonomy into same query to list all posts together on my home page? for example: $args = ...
2
votes
1answer
357 views

SQL Query inside Widget

I have a widget which contains the following code: <? global $wpdb; $querystr = "SELECT name FROM wp_venues WHERE name ='".the_field('venue')."' "; $info = $wpdb->get_var($querystr); echo ...
0
votes
1answer
599 views

Custom WP Query from meta_value stored as serialised array

I'm using a Magic Fields 2 multicheck box to store Services which can be assigned to Case Studies. The data is stored as a serialised array in WordPress, and I need some help to extract the "related ...
1
vote
1answer
3k views

Multiple WP_Query loops with Pagination

There are a few other questions about this (and WP_Query pagination seems to be a huge question for a lot of people) so I'm trying to narrow down exactly how to make it function. I'm able to create a ...
0
votes
1answer
48 views

Date not appearing in custom query

I'm having a weird issue with Wordpress which I cannot solve by myself, and for which I couldn't find an aswer over this and other websites. Basically, I have a custom loop. while ( ...
1
vote
1answer
369 views

WP_Query filter and order by meta ordering by wrong joined table

I'm trying to both filter and order a Wordpress query using the meta_value, however the ORDER BY part of the query seems to be working on the wrong table. The query params here are: array(12) { ...
-1
votes
1answer
267 views

How to write short code with if else to get page_id?

<div class="group-training"> <?php while ( $page_loop->have_posts() ) : $page_loop->the_post(); ?> <div class="entry"> <h1><?php the_title(); ...
0
votes
1answer
55 views

How to query for posts with either one or another custom field

Need help querying for posts with either one or another custom field. Not sure how to use the 'or' operator here, but something like this the blow - Have tried these: ...
1
vote
4answers
1k views

Loop through all tags & output posts in alphabetical list

I have a bunch of posts that each have multiple tags, and I'm trying to find a way to output all of them on a single page, organized under an alphabetical listing of their respective tags. E.g. if ...
1
vote
1answer
1k views

pagination not working for category.php (custom post types in categories)

it works everywhere on my site but it isnt working in category.php. When i click page to it goes to... domain.com/category/cat-slug/page/2 by the way this is showing custom post types within certain ...
0
votes
1answer
732 views

CSS class on last post in loop ( custom query )

I have been using this question to try to do this but I am having some difficutlty. I have a custom post type, media, and I am working on the archive-media.php template. I have it partially working ...
0
votes
2answers
343 views

Custom taxonomy in WP_Query not working

I'm truly stumped here. I have a specific taxonomy for sorting posts into different types of "featured" posts on a news site. Here's the problem: When querying by them the results aren't what they ...
0
votes
1answer
359 views

How to fetch only media that was already attached to a post/page?

Situation: my client has this simple gallery built with WP_Query showing the latest media added to the site: $cola = new WP_Query( array( 'post_type' => 'attachment', 'post_status' ...
0
votes
2answers
2k views

WP_Query multiple use of relation and/or

I have 2 custom fields that I would like to do a meta query on for a custom post type: start_date status The outcome that I am looking for is (start_date >= 1332115200 AND status = 1) OR ...
0
votes
2answers
2k views

Custom post type - filter content by custom meta box content

I have custom post type with some products. I need to add some content filtering now. I have custom meta box with "author". I want to add buttons with authors that will act like categories. So let me ...
1
vote
1answer
383 views

how do i remove posts from a WP_Query so the pagination is right?

I'm using a custom post type and showing 20 of them per page on the homepage. I'm using QP_Query. One custom field for the custom post type (called mixtapes) is a checkbox called "unreleased" (set ...
1
vote
2answers
425 views

How to display a posts 1 year ago with custom WP_Query loop?

I have a custom WP_Query loop that I use for the main archive page. How can I filter the custom query to diplay posts from within 2 days +/- of one year ago from todays date? My current query: ...
0
votes
1answer
169 views

Pagination not working

$paged for pagination is awlays returning 1, so no matter what page i click "1" is always highlighted and it always shows the same posts. i have tried a million different combinations of things to fix ...
0
votes
1answer
209 views

Trying to output content from page, works locally but not online

I am using the following code, to output the content from a page with the id of two. This is in my custom template file which is selected in the page. It works fine locally but online it does not ...
0
votes
1answer
453 views

How to Check if a Child Category is Being Queried

I need to change the number of posts queried for specific categories 'Recipes' or 'Product Reviews'. The below code works great for this, I have it in functions.php: function ...
0
votes
1answer
435 views

Multiple Custom Field Query

I have a unique situation where I need to filter on 2 custom fields where 1st field is expiry and values of "" and greater than todays date are valid and 2 field is a number which should be greater ...
3
votes
1answer
2k views

How do I check if a post has a post thumbnail in WP_Query?

I want to grab the 5 most recent posts that have thumbnails.
0
votes
1answer
72 views

Add category to my get_post query

I am using this Query to pull in the latest 3 post <?php $query = 'posts_per_page=3'; $queryObject = new WP_Query($query); // The Loop... if ($queryObject->have_posts()) { while ...
0
votes
1answer
261 views

Custom Post Type Query issue

I have a conflict issue with 2 custom post types. I have a template file archive-media.php and have created the related 'media' custom post type. This all works well, however in the sidebar I have a ...