"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
2answers
31 views

Get post ids from WP_Query?

Is there a way I can retrieve an array of post ids queried from the following: $latest = new WP_Query( array ( 'orderby' => 'rand', 'posts_per_page' => 3 )); if ( ...
3
votes
1answer
50 views

Order by meta_value_num DESC and meta_value ASC on WP 4.0

I have created a custom post type that I want to order by custom-field-1, which is boolean so its value is either 1 or 0, in DESC order (1 to 0) custom-field-2, which contains text and is supposed ...
0
votes
0answers
15 views

$wp->query_vars redirection giving me error

I am using plugin which is working based on short code.And I want to redirect to one template for single location. And I have given href like this to the plugin- ?wpsl-id= So basically what I have ...
-2
votes
0answers
12 views

hey!!! am developing a one page wordpress theme and I need help with the code to pull in specific page content using pagename [closed]

this is not working for me 'page-1'); $the_query = new WP_Query( $args ); // The Loop if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : ...
0
votes
0answers
29 views

Orderby Meta Value and Query from Meta Query

The following query is returning blank with no errors and I'm not sure why. Query Arguments: $args = array( 'post_type' => 'games' , 'posts_per_page'=> -1, 'meta_query' ...
0
votes
2answers
44 views

get_posts query matches too many results

I have a query inside a function that is returning matches that i don't want, for example when the $id=116 it is also returning results where the meta_key 'funds_id' is 11687. public function ...
-1
votes
0answers
17 views

how to simplify multiple wp_query with different meta values

Their are 6 total queries I need to use, below is list of 2 of them. Is it possible to simplify it? as you can see the key is the different values of meta_value, there are 1-6. <?php $args1 = ...
0
votes
0answers
24 views

Can I use pretty URLs for paramaters without query_vars?

I have a plugin that retrieves data from custom non-WordPress tables. I'd like to be able to add pretty URLs to retrieve the data, but as far as I can tell, if I use the add_rewrite_rule and ...
0
votes
1answer
30 views

How To Pick “full/thumbnail” Image In A WordPress Loop?

I am picking WordPress latest post through WordPress post loop for that I am using the below code but in this its picking all images at full size. <?php if ( have_posts() ) : ?> <?php while ...
0
votes
0answers
20 views

query wordpress page template

I'm making a one page template and have a menu set up to control the pages that are being displayed. I want to query the pages from the menu, however include the template with all the page data (php ...
0
votes
0answers
8 views

Post returns wrong result when adding Arabic parameter to WP_Query

I have a WP_Query which works perfectly when I use an English parameter like this: $the_query = new WP_Query( 'tag=english param'); but when I add this: $the_query = new WP_Query( 'tag=arabic ...
0
votes
2answers
15 views

Efficient way to update multiple post meta

I have managed to update post meta using update_post_meta(). However, the more posts I have, the more time it takes. I would like to minimize the time it takes to process say about 400 posts (although ...
0
votes
2answers
31 views

Combine privileged users array with my current query

I have a custom page template with the following query. Isotope filers my categories and all this works fine. I want now to make this page only viewable by a few specific, currently logged in ...
0
votes
2answers
22 views

How to get post id of static front page?

I'm trying to use the front page as a default of sorts for featured images (if no featured image is set, I want to use the front page's, for example) But I'm having trouble finding out how to get the ...
0
votes
2answers
30 views

Pagination not working in secondary query

I'm trying to fix a theme which has the following setup: on each page the user can select to list posts instead of the page content. The problem is that the pagination doesn't work on this page even ...
-1
votes
0answers
21 views

Cannot access to wp_query for custom query

On a custom page template, I run a custom query to get posts, here it is: $wp_query = new WP_Query( $args ); if ( $wp_query -> have_posts() ) : while ( $wp_query -> have_posts() ) : ...
0
votes
0answers
25 views

Show sticky post before other WP_Query

$recent_posts = new WP_Query( array('posts_per_page' => $blog_num_posts, 'paged' => $paged, 'post_type' => 'post', 'post_status' ...
0
votes
0answers
24 views

Sort order not working properly with meta_query

I have a template that pulls a custom post type for properties and sorts them by state. The script works properly until you add in a meta_query for the agent. It pulls the correct properties, but it ...
0
votes
1answer
17 views

ajax wp_query conditional tags not working

I'm trying to ajax wp_query, I got success getting posts for home page with the following code. Then I added conditional tags to modify the query for the other pages like Category page the problem ...
0
votes
1answer
22 views

Sort by custom field that is an array?

is it possible to sort posts inside a query based on post value that is in an array - but using the last element of the array? The code looks something like: <?php $mostsharedposts= new ...
0
votes
2answers
36 views

Custom taxonomy wp_query woes.

Here's a brief outline of the set-up: "The Art" CPT is where all the art and art descriptions are uploaded. In this CPT you can choose the category (custom taxonomy) of the art--painting, jewelry, ...
4
votes
1answer
151 views

How to Compare Two Meta Fields

Consider two meta fields balance and monthly_price. How you would get all posts that has balance < monthly_price Thinking of creating meta query but our both fields are arbitrary or do not have ...
1
vote
1answer
29 views

Date query not inclusive despite parameter being true

I've set up a small test query to get some posts from October 1 to October 10. I published a post today ( October 10 ) and with the date query parameter of include set to true, I would have expected ...
0
votes
0answers
11 views

Do not count menu items in posts_per_page

Custom type posts are added to query for category page: function test__pre_get_posts( $query ) { if( !is_home() ) { if( is_main_query() || is_category() ) { $query->set( 'post_type', ...
0
votes
0answers
25 views

how to show a tooltip include of thumbnail and excerpt when hovering a post link in other post?

Is there any way to call thumbnail and excerpt for link of post in another wordpress post? For example when i hover a post link in other posts, it shows a tooltip include of thumbnail, excerpt. Like ...
0
votes
0answers
24 views

WP Query to order posts by multiple meta fields

This question might have an answer already in the forums, however I still wanted to ask it as this is a different more complicated version of the problem. The story: We have 2 meta fields for ...
0
votes
0answers
12 views

Inline Ajax call after term is appended with a @ or # etc. displayed in div

Basically what I would like to know is how to do the following: I have TinyMCE Advanced enabled. I would like for my users to be able to tag content with different special characters (each refer to a ...
0
votes
0answers
14 views

Nested get_template_part / WP_Query – How should I do this?

I'm running a loop that runs a certain get_template_part, and that template file itself should then run another get_template_part, with the purpose to get some posts, is this even possible? At the ...
0
votes
1answer
18 views

Comparing 2 Decimal Numbers from custom fields and displaying posts

This is really confusing me. Hopefully you can help me. What i want to do, is search for a number and display anything that is either minus 1 or plus one of the search result. The numbers that it will ...
0
votes
1answer
31 views

Display custom field meta outside loop, site wide

I've created a custom field ("breaking") with the goal that whenever one post has this field present, it will display the value in the header throughout the site (that is, all posts, pages, archives, ...
0
votes
1answer
17 views

List ALL posts within last week from current category on category page

My category template shows 5 (full content) posts per page and I want to add a list of ALL the posts during the past week for that category to the top of the page as a quick overview. So the first ...
0
votes
1answer
29 views

Pagination in custom query in a category page

In a category (I create category-123.php), I'd like to create a new custom query in order to show all the posts that have right parameters (custom fields). <?php $today = date("Ymd"); $paged = ...
0
votes
0answers
42 views

WP_Query on “property” in the options table

I'm quite new to WP and I hope this question isn't seen as too specific. It's not entirely bound to my little "pre story". I'd really like an answer to this question for future cases as well. I get ...
0
votes
0answers
23 views

WP_Query Order by Specific Post ID First

I'm creating a website where I have a need to show a set of posts from a custom loop but I need to display a specific post first. This post will be dynamically specified in the URI by a $_GET ...
0
votes
1answer
16 views

Orderby two meta fields not working

Good day. I have the following code: $args = array( 'post_type' => 'property', 'tax_query' => array( array( 'taxonomy' => ...
0
votes
2answers
44 views

WP_Query displaying ALL posts

I cannot figure out why my WP_Query always displays all my published posts regardless of what I put in the arguments. <?php $args = array('numberposts' => 1, ...
0
votes
1answer
26 views

wp_query args adding muitiple tax_querys

i am creating a custom search system which search my custom post type recipes, in the search it searches the taxonomies terms that people have selected. Now due to the way it can hard code all these ...
0
votes
1answer
29 views

Removing posts from the returned wp_query. Cannot use object of type WP_Query as array

My end goal is to perform 3 custom field filters on a sets of filters on a WP_Query. The difficulty arises as I need to use both AND/OR relations between the 3 filters: field1 = A AND field2 = ...
0
votes
2answers
53 views

WP_query orderby not working after WP4.0 update [closed]

On my Wordpress-website, I have a custom post type used to display events and a page showing all events in the database. On that page, I'm creating a new WP_Query and displaying the results ...
-1
votes
1answer
38 views

Enter a variable in the 'category_name' parameter

Is it possible to use a variable for the 'category_name' parameter? I have three pages: red, yellow, and blue. I have multiple posts that are categorized in three categories: red, yellow, and blue. ...
0
votes
2answers
18 views

Do not show children of a category

I'm trying the next code: $categoria = get_the_category(); $hijosCategoria = (array) get_term_children($categoria[0]->term_id, 'category'); $queryBase = ...
0
votes
0answers
23 views

Add different classes and use different image size on every nth post in loop

I'm creating a new site for a client and they want to have a Masonry style layout for the homepage with 3 different image & width sizes. The default class is "medium-3 small-square" but what I ...
3
votes
1answer
110 views

In loop: posts have thumbnail AND other variables

I am looking to display posts that meet certain requirements. First and foremost, the idea is to show visitors the most viewed posts. I implemented that with some help. So, I got that working with the ...
0
votes
2answers
63 views

How To Get Some Data From WordPress Database Using WordPress $wpdb Query?

I am trying to get some data from WordPress database tables in a plugin. For that, I am using the below code... global $wpdb; $findID = $wpdb->get_var("SELECT ID FROM wp_posts WHERE post_name = ...
0
votes
2answers
18 views

How to dynamically attach pictures to a carousel

I am trying to make single pages for each individual portfolio piece. I created custom posts & field types, but it only seems to allow one featured picture per post. Should I be adding my pictures ...
0
votes
0answers
16 views

Wordpress MySQL query to add multiple users with related article

What I need is to add 100 users to wordpress and each one should have one post assigned to him, like a profile page (I don't want to use the default wordpress profiles because in the feature each user ...
0
votes
1answer
17 views

Return a single custom post from multiple meta queries

I'm currently working on a widget which returns a single random featured property on a website but I'm having some trouble with my WP_Query arguments. In the backend I have 2 checkbox meta fields ...
0
votes
2answers
49 views

Carousel Loop only duplicating

I have problem with looping and WP_Query. Any idea how i can implement the multiple carouselitems please check what html output should be in html So basically one of my goal is each div have a pages ...
-3
votes
0answers
78 views

How can i add query_var to custom buddypress page?

I added a new page to buddypress with bp_core_new_subnav_item. Lets say its adress: /members/myname/example/ I want this page to handle a custom query_var. While its working like this: ...
0
votes
1answer
22 views

Custom query to order by multiple taxonomies

I got this website from a customer to fix some bugs. They are a car dealership. The previous developer created a custom post type (vehicle) and there are two taxonomies: make and model. (they are not ...