In a customization task that I am working on currently, the client wants the following changed/added w.r.t Genesis - Featured Posts widget:
- 1 Post is to be shown from either of two specific categories.
- Instead of a static (widget) title, category name should appear.
- Different font-family should be applied to the title depending on which of the two categories it belongs to.
Screenshot of the widget:
genesis/lib/widgets/featured-post-widget.php has a filter for the widget title:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( ! empty( $instance['title'] ) ) | |
echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) . $args['after_title']; |
But I wasn't sure how to use this filter to display the category nicename (slug) inside a HTML element having space separated category slugs for a specific instance of the widget. Therefore I have replaced the code that displays the widget area in the theme's (Daily Dish Pro) front-page.php with manual WP query code like so.
Added the following in functions.php:
To view the full content, please sign up for the membership.
Already a member? Log in below or here.