Ordering Subcategories

I have never used the plugin you found but it looks pretty heavy, at least on the backend, and may be overkill unless you need a lot more functionality than described in the question. get_categories operates from cached data so my thought was to simple alter the returned array rather than perform another query or … Read more

Conditional Check in The Loop’s Parameters

I would change $args = array( ‘category_name’ => $category, ‘showposts’ => $numposts, ‘order’ => $order ); to $args = array( ‘showposts’ => $numposts, ‘order’ => $order ); if ( $category ) $args[‘category_name’] = $category; This way you never pass an empty category_name parameter as a query arg.

Using class id from array for query

Try this after your $wpdb query: // collect calendar id’s $ids = array(); foreach( $calendar_entries as $calendar_entries): array_push( $ids, $calendar_entries->id ); endforeach; // query the above calendar id’s $args = array( ‘post_type’ => ‘post’, ‘post__in’ => $ids, ‘orderby’ => ‘id’, ‘order’ => ‘DESC’ ); $query = new WP_Query( $args ); You can also modify the … Read more