"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

1
vote
2answers
8k views

Woocommerce custom loop to show all the products

I'm currently working on an e-commerce website and I met an problem. My client want a page e-boutique with all the product categories displayed, followed by 3 promoted products and a button "show ...
0
votes
0answers
56 views

How to show subcategories using loop?

i am using wp_list_categories('child_of=54&title_li=') method to display all the subcategories, but it is showing only one, how can i use it with loop to show all the subcategories properly.
-1
votes
0answers
113 views

WPML conflicting with content creation via XML RPC [on hold]

I'm creating new posts in WP via an app written in Obc-C. The app pulls my iOS app reviews via JSON and creates posts and categories programmatically. Creation of posts and categories works great as ...
-1
votes
1answer
59 views

Highlighting Sub topic in a post?

Have seen this sub topics highlighter in many blogs. It gives a special attraction to a sub topics used in the post. Is this a plugin or part of code? How can I add this? http://imgur.com/UbGpz7j
0
votes
2answers
440 views

WP Query - duplicated posts once including tags in search results

I running WordPress on IIS & SQL server. As some of the plugins do not work correctly with DB ABSTRACTION I am using a lot of functions.php filters as so on. To make my search results include ...
0
votes
0answers
12 views

Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?

I have the following problem with featured tag posts I have a page of a website in wich I want to show only the posts that have setted a specific tag (using the loop). So in this page I have put ...
0
votes
0answers
25 views

Trying to filter WP query with adanced custom fields

I have a site where I output a list of cards with WP query, in Genesis using Advanced Custom fields. This is saved as a template and used on a wordpress page. It works fine until I try to filter it, ...
0
votes
2answers
403 views

get contents and permalink from a specified page

below is a query where it supposed to get a contents from a page by a specified page title <?php $page = get_page_by_title( 'About Us' ); $content = apply_filters('the_content', ...
0
votes
0answers
13 views

Why I have this strange behavior when I try to exlude the featured post from posts visualization?

I am quite new to WordPress theme development and I have a strange behavior with this custom theme on which I am working: http://lnx.asper-eritrea.com/ As you can see in the home page I have 2 areas ...
0
votes
1answer
652 views

meta_query on a date range using an array of values

How can I do a query to return the post if the custom field array contains a date that is within the specified range? The query below is basically what I am after but it does not work... // the ...
0
votes
0answers
35 views

Selecting posts older than the current Unix epoch time

I am trying to perform the following query, which originates by the fact the post's 'date' and 'time' are entered as separate fields. $args = array( 'post_type' => 'some_kind_of_posts', ...
0
votes
2answers
37 views

Filtering WP_Query result by category

Using WP_Query, I need to gather a selection of posts that are both Category1 and Category2. I want this selection to include Category1 and all of its subcategories (Category3 and Category4), as long ...
1
vote
2answers
28 views

How to use an associative array in post__in with WP_Query?

I have stored user favorite posts in the user_meta table of WordPress. The data is stored in a format, for example a:1:{s:8:"post-134";s:3:"134";s:8:"post-136";s:3:"136";}. How can I get this in the ...
1
vote
1answer
574 views

Compare post-IDs within WP_Query? (Less than / Greater than)

Can I use WP_Query to only query posts less than (or greater than) a given post ID? $filtered_query_args = array( 'post_type' => 'projects', 'order' => $prev_next=='next' ? 'DESC' : ...
0
votes
2answers
17 views

Post archive for certain post format

I am using the following code for a custom archive of all posts: $taxonomy = 'category'; $param_type = 'category__in'; $term_args = array( 'orderby' => 'slug', 'order' => 'ASC' ); ...
2
votes
1answer
41 views

Is “orderby” in WP Meta Query conflicting with Meta Query?

I'm trying to write a meta query that looks for either events starting within the next year (event_start_date between now and 52 weeks), or events that are still going on (event_end_date between now ...
0
votes
2answers
368 views

Custom search: Search posts but display parent page in results

I'm using Wordpress 3.5.1 with a modified twentytwelve theme. My main site structure is based on the Smooth Slider plugin (jQuery Cycle). I have Pages that contain only a shortcode (for example, ...
0
votes
2answers
396 views

Using tax_query creates a 1 = 0 or 1 = 1 in $wp_query->request

This is my first attempt at modifying the main query using the pre_get_posts action/filter This is the function currently hooked to it: function advanced_product_search_filter($query) { ...
7
votes
1answer
528 views

Why is the loop not empty on some 404s?

I came across a weird issue. Say you access a random url, three or more levels deep: http://example.com/a/b/c http://example.com/a/b/c/d ... Then is_404() is true. So far so good. But for some ...
0
votes
0answers
25 views

Querying and Ordering Hierachical data

I am developing a WordPress site that requires the display of song lyrics. Here's the archive data that needs to be displayed: [Released 2014] - Album Title [Track 1] - Song Title [Track ...
0
votes
2answers
661 views

Related posts in all categories of current post (custom post types)

A client of mine has custom post types that they set up using a plugin rather than defining them in the functions.php. (So, YARPP for the solution won't work). In this custom post types, they have ...
0
votes
1answer
25 views

Move posts to top of WP_Query if in certain Taxonomy?

I'm trying to figure out the best way to promote certain (custom) posts to the top of my Wordpress loop. I can't use sticky posts because they are all in a custom post type.. I was thinking of using a ...
0
votes
0answers
18 views

Fetch data from database from multiple tables matching condition

I want to fetch data from the database. I have three tables in my database: listing_master_residential, listing_master_condo and listing_master_commercial. There is one primary key, Ml_num, in all ...
0
votes
2answers
26 views

WP order ASC in custom author loop

My current author list shows authors with posts only, but its not ordered by ASC and its not working. Any ideas? <ul class="authorlist"> <?php // displays all users with their avatar and ...
0
votes
1answer
45 views

New WP_query in template not working with CPT+category on some pages

I have three page templates, homepage, documentary, and corporate, each using the same CPT WP_query code with only the category name changed for each respectively. The homepage works fine, pulling and ...
0
votes
1answer
28 views

How to get the posts published in last two days using WP_Query?

I am trying to loop through all the post to get the top most shared posts on social network. I want to use the date_query parameter in the WP_query to get the posts of last two days , last 5 days, ...
0
votes
1answer
23 views

WP_Query by Category Name

Hi I am using some code to display posts in a slider on a page, and at the top I have some code to filter it using WP_Query. Here it is, not sure what is wrong: <?php /** * Featured Content 2 * ...
0
votes
0answers
19 views

WP_QUERY loop, offset in the arguments and the paginate_links - can these work together?

I have a page where the first 4 posts from category 7 are displayed with their own query and style. Then I have a small box were I want to display the rest of the posts from category 7 and to use a ...
0
votes
0answers
11 views

Show different number of posts per page in tag archives

I am using the following code out of loop to show one post per page in tag archive. <?php query_posts($query_string."&showposts=1") ?> However, I want to show recent posts as 10 posts ...
0
votes
1answer
20 views

Where is the WP_Query instance instantiated (when working with themes)?

This may be a very basic question, but I could not find the answer. The following documentation http://codex.wordpress.org/Class_Reference/WP_Query shows the code // The Query $the_query = new ...
0
votes
1answer
33 views

How do I get my custom query to work with search results after the first page?

I am using a custom query in order to ajax load/append additional posts instead of paginating them out like WP defaults. However, when I click the button I've made to load more posts, it loads all ...
0
votes
2answers
2k views

Get posts by meta data OR title

I have a working query that calls all my posts that have a certain meta value for one of two meta keys: $term = $_GET['term']; $args = array( 'post_type' => 'some_cpt_name', 'meta_query' ...
1
vote
2answers
480 views

Mysql query LIKE not working

I'm using this code. $blog_list = $wpdb->get_results( "SELECT " . $extra . "blog_id, last_updated FROM " . $wpdb->blogs. " WHERE public = '1' AND archived = '0' AND mature = '0' AND spam = '0' ...
5
votes
4answers
16k views

query_post by title?

is it possible to create a loop of posts using WP_Query or query_posts using the title? ie $args = array('post_title'='LIKE '.$str.'% '); $res = WP_Query($arg); // the loop... // trying this ...
1
vote
1answer
118 views

How use %like% in sql statement wordpress

i use a like %text% statement in wordpress: SELECT * FROM location WHERE name LIKE "%on" OR name LIKE "%on%" i tried anything but it's not run: $wpdb->get_results($wpdb -> prepare("SELECT ...
1
vote
2answers
1k views

How do I make a meta_query OR relation work? [closed]

Here's are wp_query args: $args = array( 'post_type' => 'sportpages' ,'post_status' => 'publish' ,'posts_per_page' => 1000 ,'post_parent' => 4738 ,'meta_query' => ...
0
votes
1answer
18 views

Can't use orderby in WP_Query

I can't get my posts to order by the date, descading. I've got the following code: $jobs = new WP_Query(array( 'posts_per_page' => 50, 'post_type' => 'job', 'post_status' => ...
0
votes
0answers
70 views

Problem with WordPress 4.0 and $wp_query

On my website I have a logo area that is controlled by a function that determines which page the user is on and loads the specific content depending on the $page_id value. Since WordPress 4.0 there ...
2
votes
2answers
2k 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 ...
0
votes
0answers
8 views

Pagination on author page

I created a custom query inside author.php, and I would like to add pagination. The problem is that the result is 404 error everytime. $args = array( 'post_type' => 'wpost', 'author' => ...
1
vote
1answer
134 views

Some doubts about how the main query and the custom query works in this custom theme?

I am pretty new in WordPress theme development and I'm not so into PHP (I came from Java and C#) and have the following situation in this custom theme As you can see in the homepage I first show a ...
0
votes
1answer
375 views

WP_Query post at custom position

Lets say I have a custom query which based on two custom post types: $wp_query = new WP_Query(array( 'post_type' => array('post-type-1', 'post-type-2'), 'post_status' => ...
0
votes
1answer
265 views

wp_query for displaying attachments with a tag

So I am running the following query: <?php $args = new WP_Query(array( 'post_type' => 'attachment', 'posts_per_page' => -1, 'oderby' => 'title', ...
0
votes
1answer
70 views

Modify query after meta value

I would like to change the calendar so it will display some posts based on a custom date field. For now i am interested to modify this query: $wpdb->get_results("SELECT ID, post_title, ...
1
vote
2answers
29 views

WP Query orderby meta key natural sort?

I have this code: $args = array( 'posts_per_page' => -1, 'post_type' => 'product', 'meta_key' => 'custom key', 'orderby' => 'meta_value', 'order' => ...
1
vote
5answers
315 views

Pagination for blog posts reloading same page

Symptoms Visiting /blog/ loads the first 10 posts, as expected. Visiting /blog/page/2/ (and onward) loads the new URL but with the same 10 posts. Nothing changes but the URL. Setup Details Custom ...
3
votes
1answer
88 views

Combining two wordpress queries with pagination is not working

I am trying to combine two WordPress queries but it's not working as well as pagination. I want to display today's all posts sorted by comment count and after that I want to display all posts ...
0
votes
0answers
28 views

Complicated WP_Query

I'd like to query wp posts in custom way, I'm not sure whether or not WP_Query class can do this, but I'd like order the posts by posts that has a specific custom taxonomy and then continue with the ...
0
votes
5answers
8k views

Get all categories and posts in those categories

I am looking for a solution that allows me to print the following: Cat 1 Cat 2 Cat 3 Post 1 Post 1 Post 1 Post 2 Post 2 Post 2 Post 3 Post ...
0
votes
0answers
18 views

How to show custom post type in page hierarchy?

Is it possible to show a list of pages with a custom post type included in that list if it's parent is a page? So if I was using the query more specifically something like get_pages(), ...