Add Descriptive text to Widget text box so users can see what they contain

If you have like 20 text box widgets and you are using widget logic or something to selectively display them on various pages, it gets confusing what content is in each box IF you are not using the title box. they will all then just say “text.”

Would be nice if the text widgets had a descriptive field where you can enter a title that the system will not display, but users can identify what code or text is in a particular text widget. I hope this makes sense.

is there a way to do this that I can’t see?

I know I can enter a title and then remove all titles with CSS, but I want to display some titles.

I feel there is a way

2 Answers
2

It looks like the suggestion by @DaveRomsey will solve the problem.

Another simple idea is from a plugin by Stephen Cronin, (I’m not related to that plugin in any way.) that uses the widget_title filter:

add_filter( 'widget_title', function( $title ) 
{
    return '!' === mb_substr ( $title, 0, 1 ) ? '' : $title;
} );

where I’ve adjusted the code a little bit.

It simply removes the widget’s title if it starts with !.

This is handy for e.g. Text Widgets containing ads where we don’t want the widget’s title to display on the front-end. This approach makes it easier to manage the widgets as we can still see their titles in the backend.

Hope it helps!

Leave a Comment