Make WordPress Core

Opened 15 years ago

Closed 14 years ago

#9450 closed defect (bug) (fixed)

Widgets should allow to have no titles + widget_title not always applied

Reported by: denis-de-bernardy's profile Denis-de-Bernardy Owned by:
Milestone: 2.8 Priority: normal
Severity: normal Version: 2.8
Component: Widgets Keywords: has-patch tested commit
Focuses: Cc:


On occasion, it's desirable to have a widget with no title. In particular for the calendar.

Further, the widget_title filter isn't applied to the default value in the current WP 2.8 trunk setup.

The attached patch:

  • Allows multi-widgets to have an empty title, for easier skinning
  • Moves the default titles to the widget forms

Attachments (2)

9450-calendar.diff (859 bytes) - added by Denis-de-Bernardy 14 years ago.
fix calendar only
9450.diff (6.5 KB) - added by Denis-de-Bernardy 14 years ago.
updated patch against today's trunk

Download all attachments as: .zip

Change History (17)

#1 @ryan
15 years ago

Existing widgets will lose their titles until next time they are saved.

#2 @Denis-de-Bernardy
14 years ago

Mm... can you confirm this when you tried it? It didn't occur when I tested it.


#3 @ryan
14 years ago

Apply patch, reload front page, titles disappear. You have to go to the widgets admin and save first.

#4 @Denis-de-Bernardy
14 years ago

Ah, you mean on a verbatim install, or something like that? I think I get it.

How would you prefer that to be fixed? By adding a procedure of sorts in the upgrade scripts that actually sets the title for each widget that is missing one?

PS: the most important one, imo, is that of the calendar widget. The nbsp is a mess to skin. :-)

14 years ago

fix calendar only

#5 follow-up: @Denis-de-Bernardy
14 years ago

added patch to fix calendar only. I'll make a separate one for the other widgets.

#6 @Denis-de-Bernardy
14 years ago

(that patches also fixes #9451)

#7 @Denis-de-Bernardy
14 years ago

  • Keywords dev-feedback added; commit removed

#8 in reply to: ↑ 5 @azaozz
14 years ago

Replying to Denis-de-Bernardy:

added patch to fix calendar only. I'll make a separate one for the other widgets.

Same as #9451, replacing the id with class would break existing themes that have styling for the calendar, the nbsp can probably be removed after testing in 20-30 of the most used themes.

#10 @ryan
14 years ago

Don't know if we can upgrade this reliably. Add a "Hide Title" checkbox to work around our back-compat mess?

#11 @Denis-de-Bernardy
14 years ago

Hehe... sounds like I'm going to keep my calendar widget fix plugin. :-D

I can certainly give the patch another run. How about the following:

  • Calendar option gets upgraded by WP 2.8, so as to set the title to nbsp when empty.
  • The same for other widget options
  • The original patch is applied

#12 @ryan
14 years ago

I think some of the multi-lang plugins depend on the text switching to match the current locale when the title is not set. Actually giving it a hard default in the DB will break this.

#13 @Denis-de-Bernardy
14 years ago

Good point. So how about this patch instead:

  • apply_filter always, even on empty title
  • leave options as is, except for calendar, whose option gets upgraded on existing installs to its current setting (as modified by WP before the upgrade), and defaults to nbsp from now on.
  • calendar doesn't show an empty title

14 years ago

updated patch against today's trunk

#14 @Denis-de-Bernardy
14 years ago

  • Keywords commit added; dev-feedback removed

update patch proceeds as follows:

  • applies the widget_title filter, always (allows themes to override the calendar's default   in particular)
  • if no title is around, do not output the h2 tags related to the title

this allows to easily override the default WP behavior without breaking backward compat.

#15 @ryan
14 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [11188]) always apply widget_title filter. Props Denis-de-Bernardy. fixes #9450

Note: See TracTickets for help on using tickets.