Make WordPress Core

Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#19838 closed enhancement (invalid)

Don't display before_title and after_title if title is empty in widgets

Reported by: xarem's profile Xarem Owned by:
Milestone: Priority: normal
Severity: minor Version:
Component: Widgets Keywords: has-patch
Focuses: Cc:

Description

Hi

it's not necessary displaying before/after_title if $title is empty

Example:
wp-calendar don't have a title, so don't display $before_title and $after_title

Solution suggestion:
return false if filter widget_title notices that $title is empty

Thank you

Attachments (1)

default-widgets-19838.diff (3.5 KB) - added by thee17 12 years ago.

Download all attachments as: .zip

Change History (6)

#1 @scribu
12 years ago

  • Keywords needs-patch added

#2 @thee17
12 years ago

  • Keywords has-patch added; needs-patch removed

only about 3 of the defaults had taken this into account. This patch fixes the core widgets. I did not patch or check the occurrences in TwentyEleven or Akismet.

I have updated the Codex, however there are a large number of plugins that probably use the method of not checking that was in the Codex.

#3 @scribu
12 years ago

Wait, since $title is always a string, what difference does it make if you use if ( !empty( $title ) ), instead of if ( $title ) ?

#4 @c3mdigital
11 years ago

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

Before title, title and after title do not display if there is no title on any of the default widgets.

if ( $title ) evaluates as false and they are not shown. Closing as invalid.

#5 @SergeyBiryukov
11 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.