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

Use global query parameters in new WP_Query for presenting separate results in tag archive

wp_reset_postdata() does not seem to work here. I'm building a custom tag archive template, which should feature results from different post types in diferent boxes. <?php $query_stringa= ...
0
votes
1answer
25 views

Change display wp post type to wp custom post type

i have this code below to display wp post based on category but what i want to display wp custom post called 'wiki' based on its category. CPT wiki is from plugin, so i think already defined. class ...
0
votes
1answer
218 views

WordPress Meta Query: Relation is not working correctly

I make a custom search box and let user do search. I have added required field to my editing panel by custom meta box. I have a post which have some meta data like London as place and 13021 as post ...
0
votes
1answer
758 views

2 orderby in wp_query with 2 custom fields

I'm triyng to display hotels (taxonomy which i have created) by two 'orderby' with wp_query but i'm not success. Results looks likes: Hotel 1 : 2 persons 5 stars Hotel 2 : 2 ...
0
votes
3answers
68 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 ...
1
vote
1answer
149 views

Pre-Populate $wp_query settings with custom rewrite rules and custom template_redirect

I'm currently working on a file browser plugin which requires frontend editing capabilities for a registered user. For this scenario, I have registered some custom rewrite rules for my custom post ...
1
vote
2answers
500 views

Optional Meta Query

I have places stored as posts in WP's posts table. I am doing some geo-locating using Geo Data Store (http://wordpress.org/plugins/geo-data-store/). This is working great for me, as I can currently ...
0
votes
1answer
91 views

Hierarchical List Pages as a table

I need to generate a list of all Wordpress Pages and have them display in a HTML Table, that will be printed for offline use. First column is Blank Second column will have the Page Creation Date ...
0
votes
1answer
132 views

WP Query conflict on tag.php and category.php template

My WP_query in the header menu fails to pull any posts on tag and category pages only. Error occurs even with the Loop removed from those template pages. The menu in the header lists the parents. ...
1
vote
1answer
346 views

Query by meta_key and order by meta_value_num return orderby date

I'm trying to use the orderby and custom WP_Query features of wordpress. It works nicely to select item by their meta and to order by date. Unfortunately, it seems that I could not get the post ...
0
votes
0answers
48 views

differentiate result in parent and child custom taxonomy in wp-query

I am using wp-query for filtering results on the basis of tax_query. e.g. $args = array( 'post_type' => 'product', 'relation' => 'AND', ...
0
votes
2answers
385 views

How to show one post different from the rest?

Hi the code i am using below will show the last 5 post in whatever catergory i choose, but i was wondering, How can i get it so that the first post shows different from the other 4. I want the first ...
0
votes
1answer
132 views

How to fetch posts that are stored in the different table than (default) wp_posts?

What I need is altering default Wordpress posts-pooling mechanism so I can get posts from other tables in database, not just default wp_posts and wp_postmeta. How is that possible? I'm ready to ...
0
votes
1answer
94 views

Advanced AND tax_query in sidebar with 2 taxonomies

I have two taxonomy : brand and product. In single sidebar I am displaying the brand and product of the post in the sidebar but I would like to display all the other product of the current taxonomy ...
0
votes
1answer
449 views

WP_Query with several meta_query-statements and order by meta_value

This is my query: $the_query = new WP_Query( array ( 'post_type' => 'pass', 'posts_per_page' => '-1', 'post_status' => 'publish', ...
0
votes
1answer
157 views

How to exclude Sticky from Recent Post?

Im sorry about my english. I using below code to display recent post in my footer. The problem is, my recent post show sticky post. How to hide or remove sticky post from recent post?? <div ...
0
votes
0answers
98 views

Marginal pagination on home.php

I'm trying too make a custom wp-theme and use a few loops in home.php. But now I can't finish home.php because of pagination. How cant I realize any type of pagination with saving that kind of ...
0
votes
1answer
38 views

passing moree than one value of slugs in taxonomy using variable

array( 'taxonomy' => $taxonomy_array_value, 'field' => 'slug', 'terms' => array( $term_name ) ) This is my code where $taxonomy_array_value and $term_name are variables ...
0
votes
1answer
113 views

Display recent posts from the same category as current post in sidebar

I'm using a modified version of Twenty Twelve and I'm trying to display recent posts from the same category as the current post (except the current post) in the sidebar. I started this way but ...
0
votes
1answer
349 views

wp query with dynamic taxonomies and terms?

I need wp_query with more than one taxonomies and terms which are dynamic. Multiple terms to one taxonomies each. Like If one taxonomy is Color it has terms blue,green,red Second taxonomy is Size and ...
0
votes
2answers
400 views

wp query with multiple taxonomy?

Hello I want to get all the posts that belong to multiple taxonomies. I saw on codex but it is having only static(2) taxonomies but in my case I have variable number of taxonomies. On Codex website ...
2
votes
1answer
264 views

How can I connect to another WP database and use WP_Query?

I can connect to the other database with $db2 = new wpdb( $user, $pass, $db, $host );, but how to I get WP_Query() to use $db2? I want to be able to use the loop just the same with $db2 as I can with ...
0
votes
4answers
653 views

Accessing post->ID outside of the loop for listing child pages

I'm wanting to list child pages of my current page in the sidebar of theme. However my sidebar (left side) is before the loop in the template and the post->ID won't return anything if it's before the ...
1
vote
0answers
59 views

database query with more than a couple meta hangs and doesn't complete

I have a development website with about 70 checkboxes for custom fields. The idea is the user selects one or more checkboxes, it queries the database for all posts that have a meta_key for the ...
0
votes
0answers
19 views

Pagination won't go to page 2 [duplicate]

I've created a page which uses posts 2 posts and pagination The pagination will not go to page 2, every time I click the link it reloads the page, however hovering over the page two link shows the ...
0
votes
0answers
37 views

Doesn´t get right information from wp_Query in wordpress using Easy Content Types

Have problems to sort out right information using WP_Query together with Easy Content Types. My query looks like this <?php $query = new WP_Query( array( 'post_type' => 'buildarea', ...
0
votes
1answer
227 views

Query posts by Author and/or by Tag

I'm pretty sure I need to do some sort of custom query, but not sure about the best way to go with it. I have an author page. It needs to display that author's posts. That's fine, I can do that. I ...
2
votes
1answer
234 views

How to implement time filter to show random post 1 month for one category and 3 months for other categories

I started to work on one website after another developer and there is problem with his "popular widget" which is basically showing 3 random posts from category. There is some Switch statement which is ...
0
votes
1answer
49 views

Displaying content to search engines but via navigation only for registered users.

Displaying certain information depending on if a user is registered is quite easy as I have been using this code <?php if (current_user_can(‘subscriber’)) { ?> [content here] <?php } ...
-1
votes
1answer
37 views

query posts in wordpress

I want to filter my query results just before the_loop starts in word press. I only want the results having term_id or term_taxonomy_id equal to 1. ...
0
votes
1answer
219 views

querying on custom meta fields and sorting them by custom meta

I have event posts with multiple custom date and time fields. To pull all the events happening this week, I am querying on the different date fields. Here is my code: $today=date("Y-m-d"); $nextweek= ...
1
vote
1answer
388 views

WP_query posts closest to todays date

I have written an wp query which I would like to order in a bit of a complicated way. Some posts have a meta value 'the_date' which is an end date for the post. I would like to order posts in date and ...
0
votes
1answer
83 views

displaying a fall back query if there's nothing in the post-type category

I'm stuck trying to figure out the best way to manipulate my query so that if there's nothing in the category it will display the latest post-type. Here is the query I've got that pulls in the posts ...
0
votes
0answers
203 views

Wordpress $wpdb->query() inserts multiple rows with duplicate data

I am experiencing very strange problem with wordpress query() function. I have a form on page 1 where below code to insert a new record. if(isset($_POST["transaction_id"])){ global $wpdb; ...
0
votes
0answers
287 views

Create args for WP_Query using infinite scroll

I'm trying to use infinite scroll in my page as below. http://phototravel.flop.jp/category/japan/mothersfarm/ All photos are actually custom posts under a category. It's using jquery masonry layout. ...
0
votes
1answer
58 views

Pull Instagram images into an existing loop?

I am looking for a solution to pull Instagram images (from a single account) into a Wordpress loop and mix them chronologically with standard posts that will have been created within the Wordpress ...
0
votes
1answer
234 views

Reduce number of SQL queries inside WP_Query loop to fetch author data

This question applies to scale and does not concern typical blog implementations. I'm working on a web app where I'm running standard WP_Query to fetch some custom post types. This usually results in ...
0
votes
0answers
126 views

Complex WP_Query Using Post Date And Post Meta

I am using Wordpress as a CMS on a website which has standard posts, a custom advert post type and a custom event post type. The event post type has some custom meta which stores the event start date. ...
0
votes
0answers
105 views

Search with meta_query and tax_query

I'm working on a little database for series based on wordpress. I've implemented a custom post type called "anime", some taxonomies (Genre, a_types..) and a lof of customfields. (based on acf). Now ...
0
votes
0answers
32 views

When importing a database any page with a wp_query in doesn't work

I've noticed this a lot, when I export a database from a test site and import it into a live site, any (or most) page with a wp_query in it doesn't show up correctly (It shows the theme, but as though ...
0
votes
2answers
353 views

Set conditional on template based on referring page slug

I have a portion of a page template that is conditional upon the following elseif <?php elseif( isset( $wp_query->query_vars['details'] ) && $wp_query->query_vars['details'] == ...
0
votes
2answers
147 views

How to output comments number of a post per day?

I have a question about the comment numbers in a post... For now, I can output the total number of a comment inside a post outside the loop. That's cool enough, but I want to get show the comment ...
1
vote
0answers
350 views

Custom WP_Query for WordPress Search Results with meta_query

I am using a custom query to generate my search results. The code I am using works perfectly without the meta_query variables in my arguments array. I am trying to compare multiple custom fields with ...
0
votes
2answers
114 views

How should I approach changing the template & $query as part of a shortcode's execution?

I am working on a project where I need to be able to change the template being used if a given shortcode is used. To complicate things more, the plugin must also be able to rewrite $query if this same ...
0
votes
1answer
57 views

Advise on Templates for Custom Queries

I'm trying to figure out the best way to solve this problem. I have a couple of archive type pages that display content from multiple post types at once. For example, I've overridden the default ...
0
votes
1answer
723 views

WP_Query meta_query by array key

I have a custom post type with its meta in an array. What I need to do is query based on the value of a key in that meta array. $args = array( 'post_type' => 'my-cpt', ...
0
votes
0answers
73 views

Multiple homepage layouts as selected by user from theme options

I am working on a theme which will enable users to select multiple layouts from the theme options panel. What I did so far is to create multiple theme files, depending on each theme, put it in a ...
0
votes
1answer
108 views

How to display WP Query filters?

I'm wondering if there is a way to display current WP Query filters. I wrote a function that is supported to delete all posts and it does but when I'm using WPML and it filters posts by language then ...
0
votes
1answer
3k views

Count posts returned by get_posts in external PHP script

I'm using WP from an external PHP script by including the wp-load.php file. All functions and everything works as expected so far, except one thing: I can't get the $wp_query->found_posts to work ...
0
votes
1answer
248 views

WP_Query of a custom post type isn't working

I am trying to WP_Query a custom post type. I would like to display the post_title s in a list. Here is my code, it doesn't seem to work: <?php add_action( 'init', 'custom_faq_type_mp' ); function ...