"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

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
1k 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
73 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
390 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
84 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
163 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
47 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
486 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
554 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
409 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
171 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
205 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
154 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
166 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
488 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
107 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
245 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
208 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
107 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 ...
2
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
138 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
100 views

Different sql queries count indicator on the main page

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
575 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
124 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
570 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
411 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
144 views

BP Multi Network & Members Directory

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
388 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
391 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
578 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 ...
1
vote
0answers
1k views

Filter wordpress post categories with jquery/ajax and pagination?

Currently I have a website working with Wordpress and Jquery Quicksand (http://razorjack.net/quicksand/). However I don't want to show all posts at the same time. I wish to show e.g. 6 posts and then ...
-1
votes
1answer
372 views

How to query posts from single post format on Genesis framework

How to query posts from single post format on Genesis framework? I want to just show posts from gallery post format only. I tried this query: <?php $recent = new WP_Query( ...
0
votes
1answer
591 views

Adding custom field and querying from post table

I've been trying to figure this out for a while now. So I'm trying to add a custom field call "counter" to every single post. I try simply inserting the field "counter" to the post table. Every time a ...
-1
votes
2answers
3k views

WP_Query only ONE post, won't work

No matter what, I CANNOT figure out why WP_Query pulls in all posts, and completely ignores posts_per_page ... I only want to show one post. <?php $args = array( 'post_type' => 'post', ...
1
vote
0answers
376 views

How to order posts by meta_value and title

How do you order products in WooCommerce so that products are random, but at the same time featured products show first? Here is my code: $args = array( 'post_type' => 'product', ...
0
votes
2answers
1k views

How to run WP_Query to retrieve attachments to posts only from a particular category?

I have a WP blog with a few pages and posts and several categories. I want to write a loop to retrieve images attached to the posts (not the pages) and only those from a specific category and it's ...
0
votes
1answer
346 views

Show multiple tax_query from 2 or more post_type in a single code

i've been trying with no success to show 2 custom taxonomies from 2 post_type, here's my code: <?php /** * Display a list of the most recent news in 'Avisos' ...
0
votes
1answer
66 views

Checking url from plugin

I'm trying to change the login url from wp-login.php to simply 'login'. I'd been looking through another plugins source to find ways of doing it. Some of the applicable parts that I've got so far: ...
2
votes
2answers
2k views

WP_Query in functions.php

I've got some code that I want to turn into a function. It works great until I wrap it in said function: $args = array( 'posts_per_page' => -1, 'post_type' => ...
0
votes
2answers
286 views

WP Query Returning All Posts

I have a custom WP query that is returning every post, instead of just the ones being specified by the query. I can't seem to find anything wrong with the code, so I must be missing something: ...
4
votes
1answer
898 views

next_posts_link not working for loop called with ajax

On my homepage I display a loop of posts that I allow to be replaced by ajax search results and other custom loops. Those results are returned in a template with a custom wp_query. The issue is ...