Viewing 1 to 8 of 8 items
Tag Archives: WP_Query

Nested loops with WP_Query

I struggled with this for a while and then realised the post object of the current query needs to be saved to a temporary variable [$save_original_post_object = $post;] so it can be restored after the nested loop is finished [$post = $save_original_post_object;]. Additionally you need to setup a new post object in the nested loop  Full Article…

0

Building conditional WP_Query args based on variables

I have not seen this documented anywhere other than this thread I found on the WordPress Stackexchange: http://wordpress.stackexchange.com/questions/107471/how-to-use-tax-query-to-apply-both-terms-or-one-if-one-is-empty?codekitCB=403616342.846423 The following is my implementation of it on the NN Occ Health Job Matrix theme in the file ‘content/.php: ($body_demand_one, $body_demand_two are variables set from query parameters passed from the url.)

0

Sort WordPress archives alphabetically grouped by starting letter

I know of no plugin that does this. However, some custom coding displaying every letter regardless of having posts or not: http://wordpress.pastebin.com/f524c9f4 Version that only displays letter heading when one or more posts fall under it: http://wordpress.pastebin.com/f2302b7cb Or try this:

0