"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
33 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
60 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, ...
1
vote
3answers
201 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
0answers
243 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 ...
0
votes
1answer
150 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'), ...
3
votes
1answer
744 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 ...
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
96 views

How can I detect if the current post is in this loop?

My featured articles have been built with the following query: $featured_posts = new WP_Query(  array(  'post__not_in' =--> get_option( 'sticky_posts' ),  'meta_key' => is_featured',  ...
0
votes
1answer
678 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 ...
-1
votes
1answer
254 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 ...
0
votes
1answer
198 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' => ...
1
vote
1answer
205 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
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
175 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
2answers
2k views

How do I Use Multiple Loops with WP_Query?

Hi I am trying to add post from a certain taxonomy term to a cpt loop. The code below is the code I am using. <?php // Create empty array to store post ids in $excludes = array(); ...
2
votes
1answer
4k 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
57 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
116 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
1answer
367 views

WP_QUERY tax_query not working

$query_args = array( 'cat' => $lesson_id, 'meta_value' => $lesson_type, 'post__not_in' => array($current_post_id), 'tax_query' => array( array( ...
0
votes
3answers
828 views

How to find if a post with custom_field == X exists?

I need to find if a post with a custom field X equal to Y exists in a wordpress installation. Should I do it with a simple sql query or is there something build in that can help me achieve it?
5
votes
3answers
2k views

Query Posts by Custom Field 'Price'

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 ...
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 ...
0
votes
1answer
265 views

cloning a WP_Query

I'm working with several nested loops in order to create a statistics table for teams in a league and I'm having trouble getting my original query back. I've read that I should clone the original ...
0
votes
1answer
370 views

wpdb get_var is not returning any result (verified mysql query returns only one value)

I'm trying to modify a wordpress plugin to make it more adaptable for our needs. I have a custom user_meta called practice and we separate our users based on practice, so we need to separate quiz ...
0
votes
3answers
1k views

Undefined property: WP_Query::$post

I am working on some rather elaborate comparisons between metadata and having a bit of trouble correctly referring to results from my query. The first query to establish $team_is_home works fine but ...
2
votes
0answers
212 views

$wp_query meta_key naming issue [closed]

What I am attempting to do is sort posts by custom fields. I have a few custom fields that don't query properly and I get the 404 page. The fields that don't work I used hyphens in the naming ...
0
votes
1answer
57 views

View list of all attachments on site

I'm new to WordPress theme development and I'm trying to figure out if there is a way to display a list of public attachments similar to how you can view a list of posts with a specific tag or author. ...
0
votes
2answers
69 views

Looping through tabular data

I am trying to create a table containing information that is a result of two different loops. The first loops through a list of custom post types to display team names. The other is to provide data ...
0
votes
1answer
1k views

Query multiple custom post types in single loop

I'm aware there are several other posts that cover similar ground to what I'm about to ask. I have three custom post types running, in addition to 'posts'. I want to run a loop that pulls all posts ...
0
votes
2answers
148 views

how to invoke wordpress API from other existing PHP system

We have our own php system, now we want to have a blog function. Because wordpress are widely used, so we decided to use it. And now I want to invoke wordpress's function , for example wp_insert_user ...
2
votes
2answers
1k views

Sorting: custom query with orderby meta_value_num THEN by title

i try to run a custom post type query to match following criteria: sort movies first by year in descending order, after that ("inside" the year order) by title alphabetically. desired output: ...
9
votes
3answers
239 views

Posts with at least 3 tags of a list of tags

There is a set of tags against which posts that have at least 3 of those tags should be matched. Say there is the tags {foo, bar, chocolate, mango, hammock, leaf} I would like to find all posts with ...
0
votes
2answers
350 views

Add 'last' class to second post in featured post loop

Hi there I'm using the following query to pull in two featured posts onto the home page of a site I'm building. How do I add a last class to the second post it drops onto the page? ...
1
vote
1answer
141 views

get_posts - find out if querystring was crap and fallback is used

If we pass a String to functions like get_posts, and that string is not a meaningful querystring (for Example get_posts(' ')), the function returns the results of the default query (the last five ...
0
votes
2answers
124 views

meta_value and meta_key filtering returning no posts [closed]

this might sound like a very stupid question, and I am almost ashamed to put it here... however, after using the code straight from wp codex, and trying a couple of other variations from googling ...
0
votes
3answers
85 views

Wordpress ultra slow if I click on posts?

I have 5000 posts on my website, which I have uploaded from a CSV file. This all went well and the website is fast on the back-end and frankly on any other page. There is one exception: if I click on ...
0
votes
1answer
286 views

WP-Snap too slow (caused by WP_Query?)

I have a website with 10.000 posts... WP Snap alphabetizes the posts and puts it out with WP_Query, but it is slow as hell, which is very frustrating. My question would be: what can I do about it? ...
0
votes
1answer
148 views

Added Date Filter To Pupular Posts Query

I have the following query, which was put together with snippets in the functions.php file. <?php $popularpost = new WP_Query( array( 'posts_per_page' => 5, 'meta_key' => ...
0
votes
1answer
1k views

how do I exclude child categories from a wp_query?

I'm doing a category-based search that looks like this: $feed = WP_Query("category_name=noticias&showposts=3&order=DESC"); The problem is this also brings me posts from the child ...
0
votes
1answer
1k views

Custom Post Type Query W/Category Dropdown

I'm having a bit of trouble getting a custom post type query working coming from two drop downs. Let me show you what I'm using: The Form: <?php require($_SERVER['DOCUMENT_ROOT'] . ...
1
vote
2answers
3k views

query_posts: how to show all 'meta_value' containing a specific word?

How could you display all the post in a loop with a (custom) meta_value containing a word/phrase? for exemple get al the post where meta contains 'test'. ...
0
votes
1answer
177 views

Remove from array in WP_Query loop

I have a number of pages with a tag of 'word'. For each of these pages I want a btn/Div on the home page linking to that page. This button will display a random word from an array. I want the word ...
0
votes
0answers
56 views

Read more redirection problem

I have tried <?global $more; $more = 0;?> On pages and read more link shows but the full content is not shown. If I click read more it remains on same page. Logically I'm supposed to taken ...
1
vote
1answer
361 views

Getting the current post number / make posts increment

I'm creating a site similar to http://thegreatdiscontent.com/ in that there's a bunch of posts on the site, and only one post gets shown per page. I want to add a counter that says something like: ...
0
votes
1answer
281 views

Phpmyadmin - post editing

i am total newbie with phpmyadmin, and the first time i use it, was to delete a lot of spam comments.I m not sure is it possible to do what i want , but another option would be to go trough 400-500 ...
0
votes
3answers
404 views

shortcode for recent custom type post

I'm not a coder so I may have done some "coding" crimes, apologies. I've bought a theme who has shortcodes for last posts but not for last "custom post type". So I tried to create last "custom post ...
0
votes
1answer
100 views

WP_Query loop doen't work with my custom taxonomy

My loop don't display my all relevant posts, It's should display the all posts which started w/specific letter (if it " " then it's should display the all posts sorted by popularity) what's wrong ...
0
votes
1answer
625 views

how to get wordpress user id when user register

im creating wordpress user using wp_create_user() function and when user creating i want to add that users userid to custom table, this is the way i tried add_action( 'user_register', ...
0
votes
1answer
2k views

WP_query parameters for date range

I'm using the events manager plugin to create custom posts for events. I do not have a need for a blog, so I modified my theme's index.php file (using a child theme) for its query to retrieve the ...
0
votes
2answers
1k views

How to display post from current Taxonomy in archive page?

I am using the following code to display a random post from the current category in category archive page (using archive.php). However, when in Tag or Taxonomy archive pages, the post is not correctly ...