"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
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
803 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
466 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
536 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
1k 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
41 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
195 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
223 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
327 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
650 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
148 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
203 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
154 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
374 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
222 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
407 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
3k 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
20 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
425 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
192 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 ...
0
votes
1answer
405 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
135 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
93 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
3k 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
483 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
193 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
579 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
135 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
74 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
96 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
192 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 ...
2
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
178 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
301 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
361 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
227 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
243 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
4k 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
50 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
163 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 ...
1
vote
0answers
44 views

paginate_links refers to “Not Found” page [duplicate]

Possible Duplicate: paginate_links() don’t properly work in search.php? I'm trying to make a simple pagination nav menu, using the following code: global $wp_query; ...
4
votes
1answer
518 views

WP_Query ignores post_type in category view

I have following query to select posts by my custom post-type. This works fine while being on the frontpage (the snippet is included in the sidebar). As soon it gets executed on a category page the ...
10
votes
2answers
11k views

Meta_query compare operator explanation

I noticed that there are bunch of operator can be use for compare in meta_query. However, I am not quite sure what operator I should use, it is somehow confusing like = and LIKE operator. I would ...
2
votes
1answer
87 views

Which filter/action hook gets triggered after a query has been performed?

Is there an action or filter that gets called after an instance of WP_Query performs a query?
0
votes
2answers
244 views

WP_Query parameter conflict

I am writing a query to retrieve instances of a custom post type I created called "Specialist". In the query I specify a name and more than one taxonomy. I want to retrieve just those specialist which ...