"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

2
votes
1answer
242 views

List the 5 most recent child pages

I created a hierarchical custom post type for a gallery. The parent pages are the galleries and the child pages are the albums. I want to display the most recent albums on my sidebar (so basically the ...
0
votes
2answers
559 views

How to sort queried pages by an array of page ids?

I'm creating a one page wordpress website, and I need my 'home', 'about', 'portfolio', 'services' and 'contact' pages to all be on my front page. I created the following page template for my front ...
0
votes
3answers
382 views

How to check the array values, what WP_Query has brought to me?

I have two questions in a row: How to check the array values, what WP_Query has brought to me? If I get 10 posts in cat=3, then I want to get only 5 from them, and then want to echo them ...
0
votes
1answer
422 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
97 views

Making a Custom Post Type Publish Loop

I want to re-publish all previously published products of a custom post type. Let's say the post type is "events" This is what I was thinking something like this: $args = array( 'post_type' => ...
0
votes
1answer
1k views

Search another database with wp_query using new wpdb

I currently have a simple wp_query search working on my wordpress site. I now want that same search to look for results in it's own database and another one on same server. I found that I could use ...
0
votes
1answer
905 views

issue displaying variations in custom template using WPeC 3.8.9.2

I’m having trouble displaying variations in a custom built template, each time i call the wpsc function have_variation_groups() within my loop i get the following php error ...
-1
votes
2answers
513 views

How can I use AJAX with check-box categories?

How can I build a search filter (something like this) with WordPress? I have a custom post type name: "Locatii". It is a custom post type with categories. Ex: Cat 1 , Cat 2 ... and so on. How can ...
0
votes
2answers
619 views

Comparing dates in custom field

I have a function which should return the future event date: function get_upcoming_exercises( $limit = -1 ) { $args = array( 'post_type' => 'px_event', 'posts_per_page' ...
1
vote
5answers
2k views

WP_Query returns no results

I'm using wp_query to create a custom query that retrieves search results but it is returning 0 results. Here is the code: $query = 's=the&posts_per_page=5&paged=1'; $custom_query = new ...
0
votes
2answers
45 views

send user to first page of results when reposting to page?

I have a custom template with a drop-down that filters posts by category. I do it by making the form post to the page itself and then catching the argument and using it in a query (see code below). ...
0
votes
2answers
197 views

How to query custom post then display sections by meta value

This seems like an easy thing to do but I am missing something here. I have a custom post type called "recipient" and a meta check box called "yes_current" - (we help children with cancer and run ...
1
vote
2answers
241 views

Return one unique custom post type result when it shares a custom taxonomy in WP_QUERY?

Is it possible to remove custom post types from WP_QUERY that have a same shared custom taxonomy so that only one custom post type associated to that custom taxonomy is returned? Example: Get an ...
0
votes
1answer
108 views

Is there a better way to pull in custom content without querying posts?

I have a custom page template that pulls in media files via advanced custom fields, as well as query posts. Now, the client wants there to be three sections by default... each one populating with the ...
0
votes
2answers
349 views

How to query for a page, get data, then query for child pages of that page

Basically, I want to query PARENT for a bunch of custom field data and echo it out. Then, I want to query all of the CHILD pages of that parent and echo out more data. What's the best way to do it? ...
0
votes
1answer
704 views

How to Order a list of taxonomies? orderby?

I am using this code to fetch a list of child taxonomies. I want the order displayed to be alphabetical, but it is not! Any help in figuring out how to do it? I guess ordering it before returning it ...
2
votes
1answer
153 views

Query all posts in a given taxonomy

For sure it's very simple, but I can not figure out how to do this. I need to query all posts that has a specific taxonomy set. Like this: $query03 = array( 'numberposts' => 5, 'post_type' ...
0
votes
1answer
55 views

restrict posts per page

I want to display in a featured slideshow only 3 posts, but it is ignored and it shows a lot of posts. How to fix it? $my_query = new WP_Query( array( 'posts_per_page' => 3, ...
0
votes
1answer
240 views

Help with if statement inside while loop

I have the following snippet of code, basically I get the set value of id from the metabox, get the current id based on the loop, try and match, if htey match I want to pull the values from the ...
1
vote
2answers
166 views

How do I sort posts with multiple pages

I am using a drop-down to sort posts by title, meta_value, etc. However, the sorting feature only works on the first page. The second page displays the default order rather than continuing the order ...
0
votes
1answer
414 views

Excluded category from loop

I'm using this to exclude a particular category from the loop. It DOES that, but it also does this: On my PAGES, it displays the posts from the categories other than this one which is excluded. /** ...
0
votes
1answer
229 views

WP_Query breaks pagination

I've been on this problem for a week now. I've searched through countless posts that just aren't answering the question. It seems that my wp_query breaks pagination. I've looked through a lot of the ...
1
vote
1answer
453 views

How can I combine meta_query queries?

I'm trying to build combined meta_query queries but they don't work. Any ideas how I can implement queries like the example below? Thanks, Hinnerk Array ( [relation] => AND [0] => ...
4
votes
1answer
4k views

Find out total number of pages in global query on archive page?

I'm trying to find out whether there is more than one page of posts (I've set my posts per blog page to 5 in the reading settings) in a custom category template. I would think the global query would ...
0
votes
1answer
21 views

Add content depending on page loaded

I would like to add some code depending on which page the users are. <?php $arr = array(2506, 2516,2512,2513,2509,2515,2510,2508,2514,2511,2507); if (in_array(the_ID(),$arr)){ if ...
3
votes
1answer
540 views

Order posts by ID in the given order

In the back-office of my theme, the users can choose which posts to display in the front page, and they can also choose in which order the selected posts should appear. I have tried like this: ...
0
votes
1answer
235 views

Using WP_Query() in Magento shows error

I am using Magento (directory example.com/app) and WordPress (directory example.com/blog/wp-blog-header.php). When I set up a WP_Query in Magento's template\catalog\product\view.phtml it shows the ...
1
vote
1answer
464 views

Using WP_Query within an mu-plugin

I'm trying to create a list of parent IDs for a custom post type for use within a "must use" plugin I'm developing on a project. Here's the code I'm using to generate the query: $cpt_parents = new ...
2
votes
1answer
139 views

Why execute the_post()?

When I'm getting custom post types with WP_Query->query(), it isn't really necessary to execute the the_post() function, because you can iterate over the query result array. Is it considered good ...
2
votes
2answers
95 views

Custom Loop in Page Admin Causing Other Fields to Fail

I created a custom loop in the page admin section to manage a custom post type called "widgets" for that page. $ps_widget_list = get_post_meta( $post_id, 'ps_widget_list', true ); //first get the ...
1
vote
1answer
4k views

Loop within a loop?

I'm using a couple of custom wp_query loops on my page, the first one retrieves news from a certain category then displays a small excerpt from it with the permalink. The second one is another ...
0
votes
2answers
1k views

Custom template for password protected page

I have a password-protected page, for whom I'd like to use a custom template to query posts from a specific category. How can I achieve that query_posts should work only after users submit the ...
0
votes
1answer
513 views

Exclude post formats in custom loop

I'm trying to exclude all post formats but standard from a page template loop that displays 4 latest posts. For some reason I can't get the query to work. This is my page template global $paged, ...
0
votes
1answer
209 views

Links in the_content not linked

I have alot of old posts that are being pulled with the_content() context. In the_content() there is links in the text, however none of them are hyperlinked it just shows like ...
0
votes
1answer
623 views

get_pagination not working on a custom post type query (using WP_Query)

So I have a page on my site for press releases, and the press releases are a custom post type. I'm using a custom template called page-press.php for the Press page, and I want to display a loop of the ...
0
votes
2answers
142 views

Search Page Returns Nothing

I'm currently working on this website and a test shows that the search page isn't working properly. Every time someone searches for something, it comes up blank. The code for the search page is as ...
1
vote
1answer
75 views

change recent posts based on category

I am writing a code to display the recent posts of different categories. On clicking category 1, I want to display the recent posts from cat1 and on clicking cat 2 the recent posts from cat2 and so ...
0
votes
1answer
104 views

How to disable the editing of the time and date published?

I would like to ask how to disable the editing of time and date published? Also, I would like to ask if it's possible for people who doesn't own the blog to post, not just comment, but post their own ...
1
vote
1answer
204 views

Pagination working everywhere but the index page

No idea why but pagination on my homepage isn't working although it works in every other place..custom templates, archive, searches. I've tried every version of pagination possible it seems. I've used ...
3
votes
2answers
4k views

Combining queries with different arguments per post type

I am building a section on a site where I am merging two different post types into one loop, and then displaying them randomly. The problem is, I'm having a hard time finding a way to limit the amount ...
1
vote
1answer
191 views

query order by date on custom type: wrong order

I know there are very similar questions ans answers out there already, but I simply cannot get my query to get into the right order. I have a custom post type ("bb_articles") with custom fields, ...
0
votes
1answer
328 views

How to get all post except particular category without breaking the paging

I'm trying to get all post except particular category this works fine but it cause the pagination button/link to render the same posts again on page 2, 3, 4 and so on not rendering the older post. ...
0
votes
1answer
388 views

WP Query - posts only by specific user

I have problem. I need insert this wp query $cust_loop = new WP_Query( 'author=123' ); But I cant remove the $args from $cust_loop = new WP_Query($args); And i tried everything like$cust_loop = new ...
0
votes
1answer
262 views

wp_query with parameters

I have a custom search page via which I select: One or ALL categories One or ALL tags One or ALL authors A search string or no search string On the results page, wp_query works when I have selected ...
0
votes
1answer
39 views

wp-query problem with author

I run the query: SELECT post_author FROM `wp_posts` and see that many posts have as author the value 1. I then execute in my search.php the following: $args = array( 'author' => 1, ...
0
votes
1answer
255 views

Converting multiple loops into one single loop with pagination

I am using Isotope jquery plugin to filter/sort posts in Wordpress but to correctly filter the posts into the right order I have needed to output each category one after the other. To do this I've ...
1
vote
1answer
5k views

Add custom post type items from frontend

I am trying to figure out on how do I make my wordpress website to be able to add portfolio items from the frontend. Plugins such as WP-User-Frontend allows posting from frontend but only works with ...
0
votes
2answers
51 views

Can't understand why sometimes a [caption] field appears

I'm trying to make a php script which, given a post id, returns post content. I'm not the one who writes articles, I'm just operating on a wp site. Post content is for an app of mine which has to ...
-3
votes
3answers
164 views

How to handle wp_query?

I want one particular category insert 12 post, but I only see some few posts. Just like first time first 4 post and other time other post. What can I do? Editor note: I understand the issue is ...
0
votes
3answers
3k views

Wp_query order by multiple custom fields?

I am learning WP_query and recently ran into a problem. I need to do a query where i first filter trough one or more custom fields, which works great thanks to meta_query. However, i also need it to ...