"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
0answers
76 views

Pagination problem - multiple loops conflict with wordpress default Post per Page [duplicate]

I have created a Custom Post Type (named: item) and two loops in that. First for showing Stickies, and second for other posts. My code works fine with this but: I want to show 16 of them on each ...
0
votes
1answer
38 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, ...
-1
votes
2answers
177 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
444 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
1answer
112 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
2answers
262 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
35 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 ...
1
vote
1answer
456 views

Pagination on with query_posts in custom post type template

I know there about a thousand pagination issue questions on here, and I've looked at them, but I can't seem to figure out what's going wrong with mine. This is a loop on a custom post type archive ...
2
votes
1answer
4k views

Wordpress Pagination Not Working - Always Showing First Pages Content

I am working on a website where I have a blog but I also have a custom post type to allow me to drop in some videos. I would like to use pagination so that if there are more then 9 videos displayed, ...
0
votes
0answers
358 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 ...
0
votes
1answer
485 views

Group posts by meta_key

I have a Problem with grouping meta_values. The Query looks for posts with the meta key "company". I want a unique listing of the colors like: blue red yellow array_unique was not successful and also ...
-1
votes
2answers
50 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 ...
0
votes
1answer
190 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. ...
1
vote
0answers
95 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
133 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
2answers
415 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 ...
0
votes
1answer
171 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 ...
0
votes
0answers
133 views

Ordering Custom WP_Query loop by meta key value with pagination

I am trying to Order custom post type results by a meta_key value with pagination. The pagination is working fine and I suspect I can't use the same $args that I am using with my new WP_Query in my ...
1
vote
3answers
81 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″) ...
-1
votes
1answer
130 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
137 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
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 ...
2
votes
3answers
161 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
246 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( ...
0
votes
2answers
1k views

How to adjust found_posts so that it accounts for offset and pagination

So far this is the code I have in my index.php file: <?php // Custom code to offset posts and setup pagination $page = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1; ...
2
votes
1answer
124 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
41 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 ...
0
votes
1answer
1k views

How to pass custom parameter to WP_Query for filtering in pre_get_posts

I have an ajax request that returns the result of a WP_Query loop. I would like to detect in pre_get_posts filter the specific wp_query instance that is used in the ajax handler. I thought placing ...
0
votes
1answer
212 views

Advanced WP Query and/or

I'm trying to create an advanced, reusable query function. I need to query by category OR a category + a tag. I know how to do this with custom fields (meta queries) but how do I do it with simple ...
0
votes
1answer
170 views

Display First posts without the default featured image

How can i display in loop (paged) the posts without the default featured image ? Here is my query of my custom taxonomy template page : <?php $term_region = get_term_by( ...
0
votes
1answer
139 views

wp_Query with 4 post meta feald arguments gives 500 internal server error

I am creating a custom plugin to search for custom post type provided with 4 meta field arguments. I am using wp_Query() to fetch the search results. My Query string is. $args = array( ...
0
votes
1answer
1k views

is_tax() function not working as expected

I'm facing an issue with the is_tax() function. I'm a class method that fetches a specific custom post types. These custom post types have taxonomy related custom fields (among other custom fields). ...
0
votes
1answer
34 views

Print out last 3 blogposts

From problem to problem, disco to disco :P My template requires that i print out headlines of 3 last blogposts in the header of my template. Its single page layout so those blogposts will link to ...
0
votes
1answer
62 views

Pagination 404 on Index with custom query

On my wordpress index, I use a custom query: $paged = (get_query_var('page')) ? get_query_var('page') : 1; $project_query = new WP_query(array( 'post_type' => 'project', 'paged' => $paged, ...
0
votes
0answers
280 views

How to create dynamic menu from HTML

I tried creating a dynamic menu from HTML, I registered menu in function name is main menu, Here is the HTML code that display the main menu- <div class="submenu"> <div ...
1
vote
3answers
213 views

Single page theme

I am trying to create single page theme. What i have trouble with is understanding this whole wordpress query logic. There is query object and supposedly i get all published posts like this: ...
0
votes
1answer
154 views

Post Title Not showing up

Hi i'm using this code to call post from a certain category <?php $queryObject = new Wp_Query( array( 'posts_per_page' => 3, 'post_type' => array('post'), ...
1
vote
1answer
3k views

get_query_var function not working at all

Yes, there are some similar topics about this function, get_query_var('paged') giving same result blog posts sorting doesnt work while using get_query_var I am using wordpress3.5, I have my own php ...
0
votes
1answer
877 views

Trying to check and see if a post has a featured image outside of the main loop

I've got a situation where I need to find out if the currently loaded post has a featured image, if it does, I want it to display a different logo than if it doesn't have a featured image associated ...
0
votes
1answer
92 views

“paged” in WP_Query returns 0 posts

If i don't supply a paged value (get the first page), it works. But when i try to get the next page by doing paged => 2 it doesn't find anything even though there are plenty of posts to get. ...
-1
votes
1answer
286 views

Narrow Down a Shop Page Results Based on a Product Tag in WooCommerce

I have a shop page that displays a product (chairs) for a retailer in multiple cities. Each city is a tag for each product. What I want to be able to do is narrow down a category page like (chairs) or ...
1
vote
1answer
224 views

Wordpress custom archive page

I am trying to build up a custom archive page. However, I would like this archive page to skip the first 5 posts. I've been able to accomplish this with the offset property. However, the pagination ...
0
votes
1answer
215 views

WP_Query based on multiple metadata comparisons

I have created a custom post type with custom fields and I need to filter them based on several meta data values. $args = array( 'post_type' => 'match_report', 'post_status' => ...
2
votes
1answer
5k views

Using OR conditions in meta_query for query_posts argument

I have searched high and low for this but I cant seem to locate anything. I am trying to filter some results and when I make an args array like this and pass it to query_posts I noticed that the ...
0
votes
1answer
184 views

Query post by date (stored custom field meta as yyyymmdd) and differentiate across 12 months

I have a post type that holds a custom meta field with a date in it. The date is stored in the format: yyyymmdd. On the archive page for this post type I want to create 12 separate containers, one ...
0
votes
1answer
48 views

Advanced Taxonomy query, with 3 post types

I'm been trying to figure out how to do this for a few hours now and Have final given in to asking for help. I've got 3 custom post types that I need to query for a term called home which is inside a ...
0
votes
1answer
62 views

why the same code got different results when using query_posts in functions.php and index.php

I am using WordPress 3.5, and my blog sites have many registered users. After they log in, I want them to see just their own posts, not others. So I added this to my functions.php, but I get a blank ...
0
votes
2answers
124 views

Custom query to show posts

I am trying to sort posts based on rating (using wp-postrating plugin) and numbers of comments. I have made this using wpdb, but i kinda wish to make it easier and use it with wp_query. Seems that I ...
0
votes
2answers
37 views

Not the typical order by posts by date question

I am using WP_Query to get all posts from a custom post type. This works great for listing out all the posts. However, the post itself has a custom date field and I want to list all posts for a ...