0
votes
0answers
16 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
1answer
34 views

Next 10 posts data of currently viewing post in blog page

I am developing a theme and using WP_Query to fetch the content from the database, but now i wanted to implement a loop using a WP_query that will show me the next 10 posts with title links and ...
1
vote
2answers
41 views

Transient not working for custom loops

I'm working at a WordPress theme. Since I need to display featured posts, related posts, some widgets with recent posts and so on, I need to use multiple custom loops. Because of this, the number of ...
0
votes
1answer
28 views

How to overwrite orderby with add_query_var

So I would like to have an archive that displays its posts in a random order. <?php $query = new WP_Query($query_string."&orderby=rand"); ?> But also then if the user chooses they ...
3
votes
1answer
38 views

Query Custom Meta Value with Increment

I have a Query searching for a meta value I have added to my posts (meta-select). I have it feeding out in a loop with 4 results. Let's say I want this loop to start with the meta value "2" and work ...
0
votes
1answer
39 views

Some doubts about how the loop work (trying debugging it)

I am very new in WordPress development (and also in PHP development, I came from Java and C#). Today I have installed Aptana and configured XDebug to inspect what happens into the TwentyTwelve theme. ...
0
votes
0answers
28 views

Title outside of the loop in page template

I have a page template, with a very simple default query. The problem is that the title is outside of the loop, because of the layout. What do you think, is it problem? Or do you know an other way? ...
0
votes
1answer
21 views

Grab next post title in archive page

I am using a custom query on a page to display single posts from a specific category, one post per page. Here is my current query: $results = new WP_Query( array( 'post_type' => 'post', ...
0
votes
1answer
57 views

How to get list of posts from permalinks?

I am using an API which tracks metrics on parts of my site. The only useful bit it saves though is the URL (permalink). What is the most efficient way to query up all the posts that match those ...
1
vote
2answers
43 views

How can I paginate this?

Been trying to use the pagination functions in wordpress with this code <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( 'post_status' => 'pending', ...
0
votes
2answers
73 views

Echo array value

I have following query to store data for last week entries in database: for ( $i; $i <= 7; $i++ ) { $val[$i]= $wpdb->get_results( "SELECT COUNT(`order_total`) AS 'Total' FROM vm_orders ...
0
votes
0answers
41 views

Problems With Query and/or Template Part and/or PHP

I'm trying to show only the last article. I made content-latestnews.php and it worked before meddling with queries. Template part was shown, but after I tryed to show the actual content it would show ...
1
vote
1answer
56 views

How to display posts by vote count and if no value continue with latest posts with no votes?

Maybe someone can help me with this. I want to display posts by votes. Users can only vote up. So what I want is - the most voted posts by vote count on top and then latest posts with no votes. The ...
0
votes
1answer
826 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
1answer
17 views

meta_query dates from an array

I have the below query which isn't returning anything. The query is meant to look for the date (2014-03-01) that is in the array, which it is. Any ideas? Or would I need to use a custom SQL query? ...
0
votes
1answer
78 views

Multiple Queries and Loops within CPT Archive

I have a Custom Post Type called 'properties', and have set up an Archive page to display posts within that category. Essentially, the Archive page needs to contain 3 different query types; the first ...
0
votes
3answers
306 views

Is_single() conditional tag returns null in query

Trying to figure out why this won't work for me. I'm simply trying to run a loop of all posts and pages, and tag them as post and page in a array. But the is_single() conditional is not working, all ...
0
votes
1answer
56 views

I am officially missing something about transient posts

I have no issue creating transients. What I have an issue with is pagination - and I have made posts on it before and every one sates that the query must look like, for example: $queried_post ...
0
votes
1answer
51 views

Category slug in in loop always the same?

My post category structure is 3-level deep: Products Milk products Milk Chocolate Cheese I want to show all posts from "Milk products" and add appropriate category slug as class, for example ...
14
votes
2answers
11k views

How to fix pagination for custom loops?

I have added a custom/secondary query to a template file/custom page template; how can I make WordPress use my custom query for pagination, instead of using the main query loop's pagination? Addendum ...
1
vote
1answer
74 views

if/else on custom query gives 200 OK when condition not met?

What? I am modifying my theme to show comments of a post on a separate page. How? Mostly based on this answer but with improved checks and code. So this is what my page-comments.php (kinda) looks ...
0
votes
1answer
81 views

Exclude taxonomy term from all loops, but having it on widget

I have excluded a custom post type taxonomy term from all posts like this: add_action( 'pre_get_posts', 'exclude_category_posts' ); function exclude_category_posts( $the_query ) { $taxquery = ...
1
vote
1answer
170 views

How to go about combining dropdowns / filter queries?

I'm coming up short with my googling here. (As 'filter' in wordpress always turns up more content related info). Anyway, my situation is this: I have Categories, Tags, Authors and Archive dropdowns ...
1
vote
1answer
107 views

Transient pagination not working properly

So I wrote the following to create a transient: $wp_object_i_created = new WP_Query('cat=1'); set_transient('category_one_posts', $wp_object_i_created, 60*60*1); Ok so then I decided "Ya know lets ...
1
vote
1answer
179 views

Undefined WP_Query::has_posts()?

This must be wrong. I was testing something so I did: $queried_post = new WP_Query(array('posts_per_page' => 5, 'offset'=> 1, 'category' => 1)); var_dump($queried_post->has_posts()); ...
0
votes
1answer
40 views

Get query result before posts are displayed?

If I want to modify the query, I can use pre_get_posts filter. But what if I want to loop through the queried posts before they are ran through the The Loop? Is there a filter/action hook for that? I ...
0
votes
0answers
43 views

Detecting top parent category fails on home page

I have the following method to detect a top level category. But it fails on home page returning alway true. //detect parent category function in_parent_category($cats,$_post=null){ foreach ...
0
votes
1answer
915 views

Query multiple custom post types in single loop

I'm aware there are several other posts that cover similar ground to what I'm about to ask. I have three custom post types running, in addition to 'posts'. I want to run a loop that pulls all posts ...
0
votes
0answers
84 views

Combine Query and Select Database to create directory loop

I have a query loop on my page that I am using which displays all users on the page with certain custom fields filled out. It's working fine however, I need to also query these users for their level ...
0
votes
0answers
115 views

Marginal pagination on home.php

I'm trying too make a custom wp-theme and use a few loops in home.php. But now I can't finish home.php because of pagination. How cant I realize any type of pagination with saving that kind of ...
-1
votes
1answer
154 views

Multiple loop with pagination in same page

In my home page i have two <section> in which i perform two different loops on different post categories. Here the code: <section> <ul class="loop-article"> ...
2
votes
2answers
1k views

Specific Loop For 2 <div> Within Each <li>

I need to create a loop that can logically be described as the following for a carousel: Requirements: 3 Loops 2 Posts Per Loop No Duplicates Order by Post Date Visual: < Start Loop #1 > ...
0
votes
0answers
34 views

Listing custom post type items from a couple of custom taxonomies

I know I have asked a similar question in the recent past (Listing all custom post types using a specific term on the said term's template page, in groups), but in this case, the template is more ...
0
votes
1answer
742 views

Upcoming Event: How do I sort database by custom date field, but ignore past dates?

I am using an events plugin and struggling to get my database query to be perfect. The query is on the event-single.php template. What I need the query to do: Query the "events" custom post type ...
0
votes
1answer
30 views

Custom Post type showing up in loop, regular posts are not showing up

Every one knows the basic WordPress loop, every one knows that if you want just posts in a loop you put query_posts("post_type=post"); BEFORE the loop. which I have done. The problem is I have a ...
1
vote
1answer
811 views

WP_Query: query posts by ids from array?

I did quite a bit of research but can't figure why this wouldn't work for me? echo print_r($rel); // Array ( [0] => 63 [1] => 87 ) $args = array( 'post_type' => array( 'post' ), ...
1
vote
2answers
170 views

Query reset problem or flawed code to enable custom post type query

After reading through here and trying various options, I am finally able to get my custom post types 'testimonial' (created with product 'Toolset') to show along with my standard cat/tag queries ...
4
votes
2answers
197 views

Rearranging posts based on categories

Hey everyone on Stackexchange! I'm trying to find a way to prioritize posts based on a category in a loop, which is sorted by dates. All posts are grouped under their respective dates. The date ...
0
votes
2answers
2k views

Listing custom post types on archive page with array

I'm just starting to wrap my head around custom post types and for some reason can't get any of the custom post types to display in the loop. I've found some queries online but none of them are in ...
0
votes
1answer
104 views

Exclude posts based on an array

I'm using a custom meta box to output a list of post IDs within a particular post type ("Publications" in this example). Is there a way I can output this array into a custom loop to only show posts ...
1
vote
1answer
184 views

Loop after page content

I just upgraded to 3.4.2 from 2.9 (i know, i know, but if it ain't broke...) I have page templates that are (or at least were) set up to display the page content first, then start a loop of posts, ...
0
votes
1answer
221 views

Loop to display random posts only if a custom field matches category

Working on a website and need loop that will show posts ONLY if custom field value is equal to the current category name. I have category 'fun' and custom field 'genre'. I would like to show on ...
2
votes
2answers
294 views

Splitting the main query in multiple loops with query_posts and/or pre_get_posts?

I have a custom post type 'events', to which I have associated a custom taxonomy 'calendar'. The calendar has 12 fixed terms, for each month of the year ( 'august', 'october', 'november, etc.). I'm ...
1
vote
1answer
749 views

Is there any need to use both wp_reset_postdata and wp_reset_query together?

Is there any need to use both wp_reset_postdata() and wp_reset_query() together? Is it a case that I would pick one of the two functions; is there any point in doing this after a query : ...
3
votes
1answer
2k views

WP_Query vs get_posts

I have read a number of questions on SE regarding these but I still can't figure the exact difference wrt usage. Would it be true to say that I would probably use WP_Query for the majority of ...
0
votes
3answers
722 views

Split wordpress loop to multiple layouts

OK so I've searched a lot and couldn't find a straight forward answer to my question. I am simply trying to use one category loop that will display posts in a category page in a wordpress site. lets ...
1
vote
1answer
892 views

Display category posts grouped by taxonomy

I'm working on a project where I use the default posts as "Products", default category as "Application" and a custom taxonomy called "Groups". I want to list "Products" by "Application" ...
0
votes
2answers
219 views

Transient api Caches confused

This code works for page 1 <?php $paged1 = (get_query_var('paged')) ? get_query_var('paged') : 1; $recent1 = get_transient( 'recent1' ); if ...
0
votes
1answer
111 views

Query post & loop problem.

i having trouble while i added query to loop. please have a look whats the problem. here is the link <div class="fl" id="main_article"> <?php $count = 1; $the_query = new WP_Query( ...
0
votes
1answer
161 views

Conditional category query breaking?

In my loop.php (see below) I basically have a condition where if the page is not paginated (i.e. if the URL does not look something like this: example.com/page/2) then display 2 posts with a category ...