sebe1019
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: Date Archives by CategorySo, I’ve been working on some solutions and finally got them to work.
I used this:
function my_archives_cat_filter($where, $args){ $where = str_replace("WHERE post_type = 'post'", "INNER JOIN wp_term_relationships ON wp_term_relationships.object_id = ID INNER JOIN wp_term_taxonomy ON wp_term_taxonomy.term_taxonomy_id = wp_term_relationships.term_taxonomy_id INNER JOIN wp_terms ON wp_terms.term_id = wp_term_taxonomy.term_id WHERE post_type = 'post' AND wp_terms.slug IN ('blog-de', 'blog-en')", $where); //switch the category -slugs with your desired category slug and the translated category slug return $where; } add_filter('getarchives_where','my_archives_cat_filter',10,2); add_filter('widget_archives_dropdown_args','my_archives_cat_filter',10,2);So, this didn’t just alter the output of the widget to only show the dates of the specific category; it’s also for when switching languages through a translator plugin, to also show up on the translated page and work for the translated category.
Thank you for your input earlier.
- This reply was modified 2 years, 11 months ago by bcworkz. Reason: code format fixed
Forum: Developing with WordPress
In reply to: Date Archives by CategoryThank you, I’ll be working on that right away.
Forum: Developing with WordPress
In reply to: Date Archives by CategoryHey,
So I have unsuccessfully tried to find the class attribute related to the posts. The code that I’m using already isn’t custom-made by me; it’s from a different post in this forum, which worked for the first requirement I had. Here is the link: https://wordpress.org/support/topic/date-archives-by-category/
Are there any suggestions on how the filter could look to only show the dates of the specific category?