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

How to build the WP_Query using the code?

E.g. I have something like that: $continent = $_POST['continent']; if ($continent != 0) { // get specific taxonomy e.g. with id=3 which is africa $continent_query = array( ...
0
votes
1answer
198 views

Why does Wordpress search returns same number of results for every search query?

I am hitting a brick wall, I am searching something on a site I am building and on every search it returns 10 results when I know in the index in relevanssi it shows more for the term I am searching ...
0
votes
1answer
223 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
2k views

Custom category search box for WordPress

I've seen plugins that add an additional drop down list of categories to the standard WordPress search bar, however this doesn't really help me at all. My site has a lot of posts in a lot of ...
0
votes
1answer
342 views

wp_query, give first post different formatting

I want to be able to give the first post in a custom instance of wp_query different formatting to the rest. This is a sample of my current loop (With some bits simplified to shorten my code); $args1 ...
0
votes
1answer
570 views

Custom Taxonomy + JQuery Tabs

I have created small widget on my home page which is using JQuery tabs plugin. So tabs nav is made of custom taxonomy titles and content below should be relevant to those tabs. So in other words every ...
0
votes
1answer
56 views

Get post ID's from one query and exclude from another

I have 2 instances of wp_query, one showing 4 "Featured" posts and another showing "basic" posts. What I want to do is exclude those 4 latest "Featured" posts from the basic query. I assume it's just ...
0
votes
0answers
110 views

WP_Query retrieve custom posts but not the post showing

I am developing a custom post type which shows releated posts which are within the category which is working perfect but I cant seem to get the right query to make it not show the current post which ...
0
votes
1answer
54 views

My website is getting too many dierect home arechives and this is increasing my bounce rate

My website is getting nearly 800 direct home archives daily, as a result the bounce rate of my website has increased. Usually i get only around 30 home archives a day These hits are not from Google, ...
0
votes
1answer
44 views

How to Include a common category in a custom Category Search

I was wondering how to solve this issue. This is my Query: $query = new WP_Query( array( 'posts_per_page' => 6, 'orderby' => 'date', 'order' => 'DESC', 'category__not_in' ...
1
vote
1answer
2k views

Query Custom Post Types & category_name?

I'm using jQuery Supersized to create a full screen image slideshow. The images are called from a custom post type called Slides. The code works fine but I want to be able to only pull in Slides in a ...
0
votes
1answer
573 views

Multiple Archive Pages for Custom Post Types AND Taxonomies

This is both a "how do I?" and "how should I?" question, as I'm thinking of ways to achieve my goal but they seem rather messy, so I'm hoping there's a neater way. Currently I have a custom post ...
0
votes
1answer
98 views

WQ Query post meta date comparison

I need to perform a query on some post meta which currently stores the date time lie so 31/07/2012 I need to check to see if this post meta is greater than the current date and if true return it in ...
0
votes
1answer
281 views

Search / Filter posts on Title/Content OR Tags

I need to make a custom query to look for posts (CPT) which match a certain keyword but it have to search posts in both the title, the content AND a custom taxonomy terms. I’ve tried with to queries ...
0
votes
1answer
290 views

how to use tax_query to apply both terms or one if one is empty

I'm having trouble with getting tax_query to act as a filter for posts. What I would like is to have it so it will display cpt's that have the terms of county and status but also work if terms are not ...
3
votes
1answer
771 views

Using is_main_query to select custom post type on certain page

I've been trying to implement some of the ideas discussed by Andrew Nacin http://wordpress.tv/2012/06/15/andrew-nacin-wp_query/ into my workflow, specifically trying to move away from using ...
0
votes
1answer
106 views

Why isn't my Meta_Query running?

Just FYI, I'm not an experienced coder, and I have had very little experience with coding PHP, it's safe to say I don't know the basics, just what I am teaching myself along the way to read and ...
0
votes
1answer
285 views

Delete Query won't run

This is the set up... <form method="post" action=""> <input type="hidden" name="delete_app_id" id="delete_app_id" value='<?php echo $adoptee->app_id; ?>' /> <input ...
0
votes
0answers
34 views

Why I getting only 1 post?

I'm using the following basic code: <?php get_header(); ?> <?php $args = array( 'status' => 'publish', 'post_type' => 'radio', 'orderby' => 'date', 'order' ...
0
votes
1answer
616 views

Get posts from multiple tax terms

I'm trying to get related posts by taxonomy term. So a post tagged to 'London' would have related posts tagged to London. The code I have works if the post is tagged to a single taxonomy term only - ...
1
vote
1answer
82 views

how to change the number of posts returned in a specific loop without making it global?

the website i'm referring to is technibility.com. If you look at it the slider on top is using this piece of code <?php if(is_home()) { ?> <div id="ca-container" class="ca-container"> ...
0
votes
1answer
749 views

apply custom where to the default $wp_query

I can read on the docs that if I need to perform a custom WHERE on WP_Query I need to do the following: // Create a new filtering function that will add our where clause to the query function ...
1
vote
2answers
3k views

How do I use wp_query for WordPress search?

I would like to create a custom search form to search posts based on the values of about 4 custom fields. I tried using wp_query to achieve this but so far my biggest problem is that the I don't get ...
0
votes
1answer
55 views

Retrieve post tags from from main wp_query

I'm running a custom WP_Query and find the following SQL running as part of it. SELECT t.*, tt.*, tr.object_id FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER ...
3
votes
1answer
518 views

switch_to_blog() performance considerations & alternatives

I'm currently in the conceptual phase for a multisite network. The rough idea is: There are multiple networked sites and all publish posts for their own. The network admin is able to establish ...
1
vote
2answers
603 views

Multiple Orderby's using random order WP_Query

Here is the setup. The site in question is a website that displays listings. Each listing has a rank (1-3). Basically it's a listing type... small, medium & large to determine how much the ...
0
votes
1answer
329 views

Creating a related posts section in wordpress inside a default post

I'm trying to create a related posts section in my custom theme. The objective here is if the user views a post from a certain category it will also show all the posts from that category below. I have ...
17
votes
4answers
9k views

Is it necessary to use wp_reset_query() in a WP_Query call?

I'm using the following code to retrieve posts: <?php $featuredPosts = new WP_Query(); $featuredPosts->query('showposts=5&cat=3'); while ($featuredPosts->have_posts()) : ...
0
votes
1answer
36 views

Same post appears in related Posts?

Here is the code function dark_delight_get_related_posts(){ $post = get_post(); $args = array( 'posts_per_page' => 4, 'ignore_sticky_posts' => true, ...
0
votes
2answers
389 views

Use WP_Query or query_posts() or get_posts() for optimizing a site?

I have read other answers, but I don't understand which is more fast (the best and simple for slow server running)? I have a website with over 1 000 000 hits /day and a slow server with limitations ...
-1
votes
2answers
166 views

query only direct child and sub-terms of a current term archive

i'm using woocommerce on my theme, and it comes with a proudct_cat term as a defualt catagory on the shop proudct. I need to show on every proudct_cat archive its direct child and the sub-tems, but ...
1
vote
3answers
419 views

Why wont this wp_query exclude certain pages?

I'm using the following wp_query snippet to show all pages on a single page while being able to select individual pages to exclude. // This pulls a list of page ID's from a theme options multicheck ...
0
votes
2answers
227 views

Query posts by searching for a string in a meta field

I'm trying to see if I can make this happen with the built-in meta_query function. I'm taking a $_GET variable and want to return posts that contain that string inside the meta_key urls. So far, the ...
0
votes
1answer
104 views

Get current page term title to use in WP_Query

I am trying to format a template page for a custom taxonomy and I'm having a hard time getting the term of the current page to use in the query. This is what I've tried so far: <?php ...
0
votes
1answer
34 views

How to change tag based on metabox value within $wp_query

I have a custom post type called "issue" and a contents page for each issue. I tag all of my articles with each issue by the issue number, so for instance, all articles with Issue 15 are tagged ...
0
votes
0answers
353 views

Displaying database data as pages (or similar)

I have a friend that has a big database of cars (lets say 4000 entries). Now he wants to add this info to his website. Initially I played with the idea of creating a page for each car, but this ends ...
-1
votes
2answers
49 views

Can't seem to get an else statement correct? [closed]

I'm learning my ways in PHP lately and play allot with WP and PHP. I've created a some PHP that fetches some posts with the same 1th tag. This with some help with a tutorial here and there. The thing ...
1
vote
0answers
88 views

Stale $GLOBALS['post'] after custom WP_Query empty result set bothers my template, whose fault is this?

Story below looks to me like it's about a commercial Event Management plugin whose authors to me just don't seem very good at WordPress. But bear with me and let's see if there's also an issue in WP. ...
0
votes
1answer
175 views

Dynamically name array in Wordpress loop - add/get values

I have a page set up like Page One, Page Two, Page Three Each page has a tag of 'content'. In the Wordpress loop I would like to create an array for each page with the page title as the array name. ...
0
votes
1answer
116 views

Dynamically create array from page title

I have a simple page structure like Page One, Page Two, Page Three. Each page has tag of 'content'. In the Wordpress loop how could I create an array for each page with the page title as the array ...
0
votes
1answer
155 views

get_posts always returning the same number of posts = 5

I don't understand why the code below is always displaying the same number of returned post = 5. When I change the $variable value to another post id of a post with an author with another author_id, I ...
1
vote
3answers
75 views

Multiple relationships in a query

I’m researching a bit WP_Query and me a problem has arisen. I have custom fields in tickets and would like to make a WP_Query showing this (put an example): (field1 = “data1″ AND field2 = “data2″) ...
2
votes
3answers
152 views

How to detect if a function has been fired on any page so scripts/styles can be loaded conditionally

I'm building a small gallery plugin and I'd like to only load scripts/styles onto the page IF the gallery has been loaded via the template tag. The template tag can take a post ID parameter when used ...
0
votes
1answer
30 views

How to list groupings and keep pagination

I have need to make a very custom query, and I'm not sure how best to approach it. Assume I have a custom post type that is called Package and three terms (basic, pro, premium) for the taxonomy ...
-1
votes
1answer
128 views

Next and Previous buttons are not showing on home page for post

I made a theme from PSD to WordPress but the "next"-"previous" buttons are not showing on home page. Here is the code of single.php: <div id="primary" class="site-content"> ...
0
votes
1answer
32 views

Category not being selected

I'm trying to build multiple loops for different parts of my page but I can't isolate a category. I just get to see every post the category is ignored. Below my code, any suggestions would be ...
2
votes
3answers
132 views

Explanation of WP_Query

Why am I able to use WP_Query methods without using an object of this class? Sometimes I see examples that are using the object: // The Query $the_query = new WP_Query( $args ); // The Loop ...
0
votes
1answer
237 views

How to get most recent commented post above new submitted post in Wordpress?

I have this function: $ids = $wpdb->get_col("SELECT DISTINCT comment_post_ID FROM $wpdb->comments ORDER BY comment_date DESC LIMIT 0 , 30"); foreach ($ids as $id) { $post = &get_post( ...
2
votes
1answer
108 views

Is there an action/filter called when WP_Query->query is finished and assigns posts

I took a look at the WP_Query->get_posts() function and couldn't see any action/filter that is called AFTER a query finishes. I want to be able to manipulate the results once they are sent, rather ...
0
votes
1answer
38 views

Custom Post-type not returning the right child_of

Situation I am using the Advanced Custom Fields plugin to give Custom Post Types a checkbox. If this box is checked, it should be returned by this Query. The Query works this far. The issue The ...