Filter/Sort Post Form On Taxonomy page

That happens because wp_dropdown_categories, by default, defines the name of the dropdowns as ‘cat’. You are showing 2 dropdowns in the form, and both are named ‘cat’, because you didn’t define a name for them. So when you submit the form, you get two query vars named cat. For example, if you want the second … Read more

Archive for custom fields?

WordPress does not support by default custom_fields archive like for taxonomies (yeah, taxonomies can have categories) but we can create a destination page with page template (linked from the listed custom_field) and added a searching on the custom_field, like this (from the listing page): <?php if (get_post_meta($post->ID,’_my_meta’,TRUE)) : $key_meta = get_post_meta($post->ID,’_my_meta’,TRUE); endif; ?> <a href=”https://wordpress.stackexchange.com/questions/92473/<?php … Read more

Sorting past events by month

Using query_posts is pretty much always a bad idea as it causes another database query but it also will break pagination and can cause other issues as well. What you need it a filter on pre_get_posts. function pgp($qry) { if (!is_admin() && is_main_query() && $qry->is_category(3709)) { $qry->set(‘orderby’,’meta_value’); $qry->set(‘meta_key’,’Deadline’); //formatted YYYYMMDD $qry->set(‘ignore_sticky_posts’,true); } return $qry; } … Read more

Display post count on archive page in reverse order

You can give a try to this within a loop <?php echo $wp_query->found_posts – $wp_query->current_post ; ?> $wp_query->found_posts gives the total number of posts found matching the current query parameters. So the if there are 20 posts, result for each post should look like this For 1st post it will display 20, i.e. 20-0=20 For … Read more