• I’m looking for a hack to display custom taxonomies in the sidebar. I know there are quite a few plugins available for such but I was hoping to display only the top terms used for a certain taxonomy in the last say 90 days. Any help would be appreciated.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Check out https://github.com/aubreypwd/wp-forums/blob/topic/custom-taxonomies-widget/wp-forums.php

    This may be a good starting point at least. What this does is gets posts in the most recent 90 days, gets all the terms associated with them, and outputs them in a list. It still needs more tweaking, like terms with duplicate names, etc. But, should get you started.

    This is where you want to set your taxonomies: https://github.com/aubreypwd/wp-forums/blob/topic/custom-taxonomies-widget/wp-forums.php#L87

    You can use the filter or just change the code, either way.

    Thread Starter deuts

    (@deuts)

    Thanks Aubrey for this. Appreciate it very much. However, I can’t seem to make it work.

    When I uploaded the plugin as is, it displayed 5 “Miscellaneous” in a list, which is by the way my default category but no posts are assigned to it yet. When i change it to one of my custom taxonomies, it displayed 5 bullet points without anything on it.

    You will need to modify the code to only include the default category once. It should work the same for any taxonomy, so I’m not sure why, when you change it, it shows empty terms.

    Thread Starter deuts

    (@deuts)

    Hi Aubrey,

    In your script in github, I just noticed in lines 46 and 50 that you used as classname ‘wp-forums-aubreypwd-ninety-terms’, when everything else you used ‘wp_forums_aubreypwd_ninety_terms’. I wonder if this has something to do why it’s not working for me yet.

    I’m sorry but my knowledge of WordPress and PHP is quite limited.

    Thread Starter deuts

    (@deuts)

    With the shiny new WordPress 4.6 and the new WP_Term_Query class, I wonder if this is now possible?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Custom Taxonomies Widget’ is closed to new replies.