WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 20 months ago

Last modified 20 months ago

#19838 closed enhancement (invalid)

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

Reported by: 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 3 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 @scribu3 years ago

  • Keywords needs-patch added

comment:2 @thee173 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.

comment:3 @scribu3 years ago

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

comment:4 @c3mdigital20 months 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.

comment:5 @SergeyBiryukov20 months ago

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