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

Get next/prev image/attachment in time with date query

I have a big amount of images in WP, that are not attach to any post. They are grouped in custom taxonomies (ignored in code below). The images get uploaded to WP in random order and the post_date is ...
0
votes
2answers
16 views

Sort Wordpress Posts Meta value by Week not Day

Right now I have a metakey called 'epicredvote', it sorts my posts by this epicredvote number. It is doing it on a daily basis at the moment, so if I have 2 posts the post with the highest epicredvote ...
1
vote
2answers
35 views

Order by menu structure

As I'm making one page website. Here is question I asked earlier: Calling Specific Pages with wp query Part II As I'm calling all pages by WP_Query which is "order by = ASC" I want to call it "order ...
-1
votes
0answers
8 views

How to display Categories as a index page style (wordpress)

Actually this code from archive.php template parament I want to style the category pages can anyone help me regarding this <div id="main" role="main"> <header id="introduction" ...
0
votes
1answer
36 views

WordPress meta_query not working

I am having issues with a meta query on a custom post type. The following arguments are set: $args = array( 'post_type' => 'wp_comp_entries', 'posts_per_page' => -1, ...
4
votes
1answer
30 views

Select all in parent category, group by child category?

I am trying to format a custom post type for a "series". Each post is an Episode, each Episode belongs to a Season, and each Season belongs to a series (just like a TV show). I have the following: ...
0
votes
0answers
22 views

Select posts with a custom taxonomy as a custom field

I am using woocommerce, so I have the product category taxonomy (product_cat). On a product category page, I would like to display the posts that are in that (product) category. That will be the ...
0
votes
1answer
12 views

parse_tax_query causing Navigation Menu To Disappear

I am using the following snippet to modify a query... function no_child_terms($query) { if( !is_admin()) { $query->tax_query->queries[0]['include_children'] = 0; } } ...
0
votes
0answers
14 views

Exclude Product Category From Query [on hold]

I have found quite a lot of thread talking about excluding categories from query but most of them are related to general posts, not product categories from WooCommerce. The closest thread to what I'm ...
0
votes
0answers
36 views

Include data from custom table in WP_Query

I'm building an Estate Agent website. They have a system where they add their available properties and sends them all to the main property portals. As part of this, the system also sends all the ...
0
votes
2answers
44 views

Optimising amount of calls to custom fields

I have this code fragment in my codebase: foreach($this->adverisers as $adveriser) { $this->data[$adveriser->name]['image'] = bfi_thumb(get_post_meta($adveriser->ID, ...
0
votes
1answer
32 views

How to delete only user meta value (not key) from usermeta table in wordpress?

I store multiple image in media library and save its id in wp_usermeta table. my metakey is 'images' and meta value in like '279,280,281'. Now I get the image from table like this: <?php $images = ...
0
votes
2answers
22 views

Wordpress altering my custom query, How to fix it?

I am querying for most popular posts by custom view count by using the custom query below, <?php $mostpopular_args=array( 'post_type' => 'post', 'orderby' ...
0
votes
0answers
17 views

How to make search for posts using get method?

So I am building a WordPress theme for myself to meet my needs, so what I am looking for now is make a search using a get method in PHP. If my URL is something like this : ...
4
votes
2answers
53 views

Display several random posts, but make sure a condition is met

I have a custom post type for a group of people (employees). At first, I needed to display 7 random employees. That was easy <?php $args = array( 'post_type' => 'employees', ...
2
votes
0answers
65 views

WP_Query sort by comment meta data

Is it possible to use the WP_Query class to order by comments meta data fields?
0
votes
0answers
36 views

Sorting Posts with meta value not working

I want to retrieve most popular posts based on 'view_count' meta value, the below code doesn't seem to work, I am getting some random posts, where am I doing it wrong? <?php ...
0
votes
1answer
21 views

Use Tags to Query Associated Multiple Posts and Get The Average Of Custom Field Values

I have created a custom post type named “Rating” that I’m using to add customer rating sections to my website. Each rating post has the ability to have a: Title Comment section Featured Photo ...
0
votes
0answers
13 views

Empty result when trying to fetc post in the future

I am trying to fetch a single post that is either scheduled or published using a custom WP Query. The query is running asynchronously. However I get no results. Here is my code: ... $args = array( ...
0
votes
0answers
34 views

Custom post types display [closed]

I have two custom post types created using CPT UI plugin, products and review. I want to show reviews on product page submitted by users. I'm able to submit review using a frontend form how do i show ...
0
votes
1answer
9 views

Display posts from catagories

I am using an option framework. This saves catagory ids.To get ids I have done $cat = $atts['post_catagory']; var_dump($cat); The var dump result is array (size=2) 0 => string '1' ...
0
votes
1answer
28 views

Issue in If else condition [closed]

I'm calling my all pages on one pages as a section. Here is my code: <?php $args = array( 'post_type' => 'page', 'orderby' => 'ASC', ...
0
votes
1answer
18 views

How to view all posts of current day as default in admin

I want to to show all posts of the current date by default (without clicking the filter button) in WordPress admin posts list screen. I have used this code in functions.php and it works almost. The ...
0
votes
1answer
14 views

Getting attachments by meta value

I'm stuck at a very simple point: I need to get all attachments by a custom meta key (and value). I'm developing a short code, so it has to work on every possible page. What I've tried so far: $args ...
1
vote
4answers
38 views

How to limit the number of post that WP_Query gets?

I have been researching on Google and WPSE and the only thing I see repeatedly is to use showposts, that is deprecated. I am familiar with WP_Query, and I thought that if I set posts_per_page to my ...
0
votes
0answers
31 views

How to get all tags of a custom post type by id

simple question, how to get all tags of a custom post type by id? post_type=product. i have tried with http://codex.wordpress.org/Function_Reference/wp_get_post_tags in my post loop and the print_r ...
0
votes
0answers
18 views

How can users subscribe to searches

How to allow users to subscribe to search queries (for example a user search on the website, using the search form, for "green apples"), and send daily email alert to subscribers when new posts appear ...
0
votes
0answers
14 views

PHP Wordpress Monthly Top Author in Sidebar

Im trying to show List of Top Author by Property Update Count (Monthly) in my sidebar. How to adjust this php code. This php only show AUTHOR list in my sidebar, not sort it by Monthly Property Update ...
0
votes
0answers
26 views

Why is $wp_query fetching nothing?

I have created a ajax file from where response will return named "ajax_show_nxt_cat.php" and here I want to list all post using $wp_query but when I try to print the $wp_query, it returns nothing. I ...
0
votes
2answers
24 views

WP_Query with multiple meta fields filter?

I have the following query but it is still returning results which include posts which have a meta value of 'deal'. Any Clues on what am i missing in this $args = array( 'post_type' => ...
0
votes
2answers
22 views

How to query images from a post to use in a slider

I am trying to pull images as attachments from a particular post (custom post), ...and I'm using the example within WordPress codex codex example to display all images as a list ...except the images ...
0
votes
1answer
37 views

How to query post into a complex slider

I'm trying to query post into a slider. Here is the HTML Markup for the slider. Each slide has slide and a relating thumbnail. <div id="example1" class="slider-pro"> <div ...
0
votes
1answer
19 views

Using custom taxonomies in a query

I'm using a plugin (IssueM) which gives the "articles" post-type a custom taxonomy called "Issues". I'm trying to return all "articles" which have the taxonomy issue-one set (which is the slug name). ...
0
votes
1answer
54 views

Custom Post Type + Category archive

I have created a WP stack with 3 post types: 1. Post (default) 2. Event 3. Place These 3 post types share the same taxonomy, that being the default WP category, here are some example categories: ...
0
votes
2answers
58 views

Specific loop in Shortcode

I'm making shortcode and I'm stuck here. Here is code: add_shortcode('service-shortcode', 'service_shortcode'); function service_shortcode($atts) { extract( shortcode_atts( array( 'title' => ...
0
votes
1answer
25 views

Calling specific page with wp query

I'm making one page website and I added a custom field on "Page" post type that asks "Use this page as a section:" Yes or No(with dropdown). I called all pages on template-onepage.php(custom template) ...
1
vote
2answers
27 views

Which custom query am I in and how can I access its properties & methods?

Sometimes there's no way around creating a custom query, but when I do and then loop through it, I often want to use get_template_part() within the custom query loop to pull in a template I already ...
0
votes
1answer
37 views

WP_Query() with custom post type and taxonomy — get all terms?

I have the following custom post type: lesson custom Taxonomy: subject which contains terms like math, reading, etc.) I have configured my page so that the user may filter the results by ...
0
votes
1answer
22 views

Every second post different class in blog view

To assign different classes to every 2nd post in blog view in WordPress adding this code into function.php was suggested as solution. Most people claim it is helpful, but to me it just adds odd at the ...
1
vote
0answers
21 views

Query posts by last comments

How to query posts by lastest comment, like what happens here, if some one comment on a post from the dark ages it will popup to the top.
0
votes
0answers
50 views

Create multiple sections for all categories and then queries all the posts for each of those categories

I'm trying to find to find a way to create a loop that queries all categories and then the posts under those categories. I am using a custom loop to display my posts and I'd like to have it follow ...
0
votes
0answers
12 views

Querying sanatized data with meta_query in Wordpress

I asked this question over at SO yesterday, but I see now that this is the right place for it to live. After Googeling this for a while, I've found that this should work cite, but I don't seem to get ...
0
votes
0answers
26 views

Why My Custom Search Form Do Not Find Specific Search Template?

I am working with my custom search. Here is the form code: <?php // ADVANCED SEARCH function advanced_search() { ?> <form method="get" id="advanced-searchform" role="search" action="<?php ...
0
votes
1answer
14 views

Show parent's child and also child's, child on a page?

I'm trying to get my head around this issue I have and the only way I can think about doing it is pulling in things via a WP_Query but you can't have a query inside a query can you? What I'm trying ...
0
votes
1answer
14 views

How can I display a specific number of post in a category via a url

I'm trying to link to a specific category in my blog but limit the number of posts that are listed. I can link to the specific category via "www.example.com/?cat=6" and after looking around the web ...
3
votes
1answer
88 views

Escaping WP_Query tax_query when term has special character(s)

Here's my issue. I have a custom post type that I'm attaching a custom taxonomy to. This taxonomy will allow the admin to provide search suggestions that will ensure the post is found when a user ...
0
votes
1answer
27 views

Displaying a div from an assigned meta_value when on a page

On my website I created a custom metabox that is being displayed in the post type "page". The metabox will display a checkbox and 4 url fields. The checkbox will control the visibility of a div ...
4
votes
2answers
149 views

Execute a large WP_Query with many “AND” Meta_Queries?

I have a custom post type product. Visitors can search products with many filters. They can set the color, the size, the price, etc. The details of the product are stored with Advanced Custom Fields ...
-2
votes
1answer
29 views

Incorrect posts displayed on category page

I'm using this loop to show my 5 latest posts but even if I'm selecting a category it still shows the 5 latest posts from all category. query_posts('showposts=5'); <?php if (have_posts()) : while ...
0
votes
1answer
28 views

Pagination not working with WP_QUERY

I have set up a custom loop that is working fine, but will not display the pagination links. After some searching around I've learned that the pagination links (as I've used them here anyway, but I'm ...