"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

2
votes
2answers
1k views

$wp_query->queried_object->ID throws warning: Undefined property

<?php $current_term = $wp_query->queried_object->name; $current_term_id = $wp_query->queried_object->ID; ?> <hgroup ...
1
vote
1answer
9k views

wp query to get child pages of current page

Can anyone please help me to with the wp_query. I am making a template file/loop to create and archive page of the current page children pages. This query needs to be automatic as I am using in on ...
0
votes
2answers
386 views

Query multiple taxonomies with pagination

i'm query multiple taxonomies and have no problem with it but pagination is not working how to solve it, i try alot of suggestion but no success here is my code if ( get_query_var('paged') ) ...
2
votes
1answer
374 views

wp_query() get_col error

I'm trying to create an auto search jQuery function by using AJAX to send data to the database and back to the search field. In my wordpress theme, I create a folder called "include" and in there I ...
2
votes
2answers
939 views

Count total number of post in foreach loop

I used the the following script (only with get_permalink....) to display posts from a post type where the post author has an extra meta field on his user page: <?php // get users from user page ...
1
vote
3answers
55 views

custom post type search by reference id

I have a custom content type of tab_content with a relationship to a page. In my current script I have the id of a page and I want to do a query that will list all the children of type tab_content ...
1
vote
1answer
485 views

Display tags that only appear in one category

I'm trying to get this less manual than it currently is. I want to display tags that appear in only a single category, so if they are in a post that has two categories, I want that tag ignored. The ...
1
vote
0answers
306 views

Does the WP_Query 'private' argument for post status only apply to privately published content?

The only peice of code that I can find that applies to this is on line 2430 in query.php in WP 3.4.1 foreach ( get_post_stati() as $status ) { if ( in_array( $status, $q_status ) ) { if ( ...
4
votes
0answers
136 views

Custom query incorrectly returning everything [closed]

I'm missing something somewhere, but I cannot connect the dots. Everything outputs properly except that the query returns everything from the DB, not just posts. Can anyone spot a reason for this ...
1
vote
1answer
435 views

Meta_query with or without value

I am using WP_Query to sorting the post by user input. The input contains meta value which is display in select type field. Normally when there is value inserted into the form, the wp_query working ...
1
vote
0answers
174 views

Query most popular terms by taxonomy over 2 week period

I have written SQL for a query that pulls the most used taxonomy terms for selected taxonomies that are published, do not have a parent post are not in a comma separated list over the past two weeks ...
3
votes
1answer
1k views

Dynamically link to the latest post or simulate request of specific post in page template

I want to have a link in the wordpress menu pointing to the latest post of a specific category. Because I am not able put a dynamic URL in the wordpress menu, my approach was to put a page with a ...
1
vote
2answers
92 views

How do you Query posts with nothing in common?

We can get multiple posts manually in a page, but that's generated in a template, AFTER the default query returned something else (page/post, etc) How do you query multiple posts in a public query, ...
0
votes
3answers
2k views

Use Ajax To filter posts?

Right now I'm submitting a drop-down form to it's own page (action="") to filter posts displayed. I'd like to not have to refresh the page, which resets the forms. Is there a way to query ...
1
vote
0answers
76 views

Get page content by category or tag

I'm trying to sort of emulate the Views behaviour in Drupal with Wordpress, but doing it in theme templates. Now, I have pages that are assembled by using wp_query in the template to get posts ...
1
vote
0answers
437 views

How to use Meta Value Compare in WP_Query For Max and Min numbers

I am using WP_Query for visitor to filter the posts. The posts is about products. So in the filter, it has a field where user can select Maximum price and Minimum price. (Just like most of the ...
1
vote
0answers
85 views

Posts published last 10 minutes

i have a "featured" section on home page. i want to hide this section after 10 minutes of post publish time. here is the code, i am using. problem is that it hide the "featured" section after 12 ...
0
votes
1answer
165 views

WP_Query do not include posts with a certain value in a custom field -

I am trying to grab the 5 most recent posts and have it exclude posts in an array that is already defined ($exclude), sticky posts and any posts that are checked off as a featured post (i.e. with the ...
0
votes
1answer
49 views

Fourth page of custom post type archive page does not exist

I recently developed a custom post type for my company's blog, so that we could have a separate press area. In the archive-presse.php page I make a query, thus : $paged = (get_query_var('paged')) ? ...
1
vote
2answers
513 views

query user display_name failed in a custom mysql query foreach

I met some trouble. I tried to get user display_name in a custom mysql query foreach, but it failed. I have tried three method. new WP_User, get_user_by and get_userdata. but they only can get back ...
0
votes
3answers
611 views

shortcode using multiple WP_Query's with multiple category names not fully functional

we're working on a bilingual site, Larry A. Downs all the posts are categorized into two categories, english or spanish, along with other categories. so every post has multiple categories, i've ...
0
votes
1answer
423 views

WordPress | Date not always appear [duplicate]

Possible Duplicate: WordPress the_date() not working I try to create a theme. In that theme I have create a custom post type and I quering the WordPress by using the wp_query to get the ...
0
votes
1answer
178 views

Attempt to display site authors in a carousel - User Image not Outputting inside li tags

I am attempting to display the authors of my site in a jquery carousel but for some reason my images are outputted outwith the li tags and I don't know why. Code functions.php function ...
0
votes
2answers
211 views

Transient api Caches confused

This code works for page 1 <?php $paged1 = (get_query_var('paged')) ? get_query_var('paged') : 1; $recent1 = get_transient( 'recent1' ); if ...
1
vote
1answer
1k views

Use get_post_types to query only custom posts types

I need to query only custom posts types - that is all post types in my WP install excluding posts and pages. I have used get_post_types to build a string of all custom post types which I want to ...
2
votes
1answer
166 views

Sort by posts that have a featured image?

I'd like to sort posts on the index page to show those that have a featured image first. I've done this in functions.php: add_filter( 'pre_get_posts', 'my_get_posts' ); function ...
0
votes
1answer
67 views

For what queries is conditional tags informative?

I think it's great to use conditional tags but if the query is slightly advanced it won't give information about the original query. For example; is_category('apple') might give a false response if ...
0
votes
1answer
177 views

Pagination in wp query with transient api

I have intergrated wordpress transient system with w3 total cache. Now i can`t to do pagination for this query. <?php $paged1 = ...
0
votes
1answer
109 views

Can't query by meta_key

For some reason. I do not have the ability to query by meta_key when I run a loop. What could cause this and what can I do to the diagnose the problem? I am using wordpress 3.4.1. $args = array( ...
0
votes
1answer
514 views

the_category() doesn't working in wp_query loop

I'm using custom post type. I want to show every post's the most child category on archive page in wp_query loop. But the_category(''); doesn't work. What should I do? I need your help. Sorry for my ...
0
votes
1answer
136 views

Adding pagination to sub-wp_query within a singular post page

So my custom wordpress theme/site has a number of venues, e.g. "foo" which has a number of events and reviews. So a venue ends up with a URL like, http://www.example.local/places/my-place-name/ ...
0
votes
1answer
59 views

wp_query: implicit paging? I get less posts that I should

A newbe wp_query question: I set a wp_query as follows, but instead of 17 posts I only get the first 10 posts from the selected Category with ID=5. Is there an implicit paging directive on the ...
1
vote
1answer
108 views

Sort query by author: 1 author, then others

I have a post type called 'article' and on the article archive page i'd like to show all the articles, sorted by author. function kia_adjust_the_query( $query ) { // change posts_per_page ...
1
vote
1answer
251 views

Pull post meta with post_query?

I'm building a custom index loop that just uses query_posts at the moment. The issue is that inside The Loop, I have to then query for the post meta data (with get_post_meta), which I believe has ...
1
vote
0answers
218 views

List authors with the last post title and order by last post date

I want to list authors with last post data and order them by last post date. Now i have this codes but i don`t know how to edit them. // Selects from tables wp_users and wp_posts, selecting published ...
0
votes
1answer
109 views

wp_pagenavi on WP_Query using customfields

I have been searching this subject for some time now, not finding a solution. First of all, sorry for my bad spelling. Im quit new to PHP, so please be gental. Im using this to list some ...
3
votes
1answer
3k views

Warning: urlencode() expects parameter 1 to be string, array given

I have posted a question on StackOverflow (sorry for the cross link) and while I'm striving to find a solution to this, I stumbled across this warning : Warning: urlencode() expects parameter 1 to ...
0
votes
1answer
49 views

How go give $value to wp_query

Probly easy question but just cant seem to find whats wrong. I cant build a query based on a search when i use ' ' but not when i use a alrdy declared variable. This works $query2 = new WP_Query( ...
1
vote
1answer
139 views

Query by multiple meta elements not seeming to work - wordpress is timing out

Trying to run a query that pulls: get me 4 posts or pages that are not in sticky_posts and have (my_featured_post = 1 AND photo-image_post_id > 0) OR (my_featured_post = 1 AND photo-image_page_id ...
0
votes
1answer
103 views

Different sql queries count indicator on the main page [on hold]

I use w3_total_cache plugin. But i can`t understand what is going on sometimes. I have enabled database caching and debug info at the bottom. Sometimes on the main page 90-96 db queries, sometimes ...
1
vote
1answer
1k views

Conditional arguments WP_Query for post custom fields

All in my case I want to get post result by Gender, Age, City etc... I am using this query. If i have any of variable like age, city, gender for that "AND" operation will perform and get only result ...
2
votes
1answer
634 views

WP_Query() show posts that end later than today

I have a query as follows: $wp_query = new WP_Query( 'meta_key' => 'end_date', 'meta_value' => 'today', 'meta_compare' => '>=', 'post_type' => 'vehicle' ); ...
0
votes
1answer
125 views

Custom Query Not Paginating

I have a site that uses a custom query to filter posts: <?php //Search Region table to retrieve array of country names $regionresult = mysql_query("SELECT * FROM gallery_regions WHERE ...
0
votes
2answers
2k views

Pass $page_id to new WP_Query

Probably pretty simple and more PHP-related than pure WP, but how would one pass the $page_id generated in the first code snip into the new WP_Query () in the second code snip? What I need to do - in ...
0
votes
1answer
576 views

paginate_links() on page (shortcode output)

On a standard WordPress page, I have a WP Query that runs through a post type I created. Along with that query, I am using paginate_links() to generate pagination. While the standard (no permalinks) ...
1
vote
1answer
428 views

WP_Query not retrieving by random order under parent

I currently have TWO subpages under parent page ID 43. Client testimonials.. Anyway. I have the random order thing in the query $args but the order never changes. What could I be missing? ...
3
votes
1answer
148 views

BP Multi Network & Members Directory [closed]

With bp-multi-network it appears members are shared across all networks. Example - networks based on location. newyork.mydomain.com, losangeles.mydomain.com, vancouver.mydomain.com At present a ...
1
vote
1answer
409 views

Why does querying on post_tags (which has been applied to custom post types) only return posts?

So I've created a little jquery cycle based feature rotator that pulls from the post_tags. I added the post tags to my other custom post types like this: register_taxonomy_for_object_type('post_tag', ...
0
votes
1answer
431 views

Replacing global wp_query

I have a site that uses a custom query to search for posts by country. The search results come back fine, but the pagination at the bottom reflects the total number of posts in the site, instead of ...
0
votes
1answer
583 views

paginate_links() with Custom Taxonomy

I have a custom taxonomy that is pulling in a list of posts assosciated with it. Previously - in the $posts_args array, I set the post_per_page option to -1 but realized pagination should be added to ...