Make WordPress Core

Opened 13 years ago

Closed 12 years ago

#17837 closed defect (bug) (fixed)

Calendar widget title markup displayed when empty

Reported by: joshstauffer's profile joshstauffer Owned by: nacin's profile nacin
Milestone: 3.5 Priority: normal
Severity: trivial Version: 3.1.3
Component: General Keywords: has-patch dev-feedback commit
Focuses: Cc:


For Calendar widgets, the widget title markup is output even if the title field is left empty. For instance, <h2 class="widgettitle"> <h2>

Conversely, when a Text widget title field is left empty, no markup is output.

Attachments (1)

17837.patch (638 bytes) - added by jakub.tyrcha 13 years ago.

Download all attachments as: .zip

Change History (7)

13 years ago

#1 @jakub.tyrcha
13 years ago

here you go

#2 @dd32
13 years ago

  • Keywords has-patch added

#3 @mfields
13 years ago

  • Cc michael@… added
  • Keywords dev-feedback added

I think that this is a great idea! In a few themes, I have had to filter the widget title like:

function mytheme_calendar_widget_title( $title = '', $instance = '', $id_base = '' ) {
	if ( 'calendar' == $id_base && '&nbsp;' == $title )
		$title = '';

	return $title;

I find that it is always necessary to do when the widget title has a background color applied. In the event that the user leaves the title blank, a weird square will appear above the calendar.

#4 @MikeHansenMe
12 years ago

Patch works perfect. It not only is noticeable when the title has a background color but creates an awkward whitespace when it is empty due to the line-height 18px being applied to the &nbsp;

#5 @nacin
12 years ago

  • Keywords commit added
  • Milestone changed from Awaiting Review to 3.5

#6 @nacin
12 years ago

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

In [21841]:

Calendar widget: Don't print widget title markup when the title is empty. props jakub.tyrcha. fixes #17837.

Note: See TracTickets for help on using tickets.