Home › Forums › Support › Hooks inside widgets? › Reply To: Hooks inside widgets?
May 24, 2015 at 2:45 am
#109954
Media Friendly
Aaand…. we have a winner!
I installed the Code Snippets plugin and added the filter.
My final code was a bit more complicated because I had to put the div in the end, and add an extra div class=”ribbon” around both elements (h4 and the div class=”ribbon-edge-bottomleft”). But I was able to figure it out with the help of Google.
add_filter( 'generate_start_widget_title', 'generate_custom_widget_title_ribbon_start' );
function generate_custom_widget_title_ribbon_start()
{
return '<div class="ribbon"><h4 class="widget-title">';
}
add_filter( 'generate_end_widget_title', 'generate_custom_widget_title_ribbon_end' );
function generate_custom_widget_title_ribbon_end()
{
return '</h4><div class="ribbon-edge-bottomleft"></div></div>';
}
It worked just great! It seems GeneratePress is infinitely hackable. Will this be upgrade-safe or do I have to worry about losing these filters on a GP upgrade?
Thank you for your excellent support.
Pedro