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…


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: 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.)


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: Version that only displays letter heading when one or more posts fall under it: Or try this: