Make WordPress Core

Opened 8 years ago

Closed 5 years ago

#22010 closed enhancement (fixed)

RSS Widget with hardcoded icon and style

Reported by: thomask Owned by: wonderboymusic
Milestone: 4.4 Priority: normal
Severity: normal Version: 2.8
Component: Widgets Keywords: ui-feedback has-patch needs-refresh
Focuses: Cc:


Standard RSS Widget outputs hardcoded icon and oldschool inline style="border:0" e.g.

<img style="border:0" width="14" height="14" src="http://zdrojak.lamp.wikidi.net/wp-includes/images/rss.png" alt="RSS">

this makes it hard to style (even more that the parent anchor has the same css class as following title, so you can't even hide it without some css3 only magic (:first)

IMO this part of WP_INC/default-widgets.php row 766-777

		$icon = includes_url('images/rss.png');
		if ( $title )
			$title = "<a class='rsswidget' href='$url' title='" . esc_attr__( 'Syndicate this content' ) ."'><img style='border:0' width='14' height='14' src='$icon' alt='RSS' /></a> <a class='rsswidget' href='$link' title='$desc'>$title</a>";

+ line 764

should be replaced by standard way e.g.

		$title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'RSS' ) : $instance['title'], $instance, $this->id_base );

so when someone wants to output there an icon, he could simply with the widget_title filter

Attachments (1)

prateek.patch (597 bytes) - added by prateek312 6 years ago.

Download all attachments as: .zip

Change History (10)

#1 @c3mdigital
7 years ago

  • Keywords needs-patch ui-feedback added
  • Type changed from defect (bug) to enhancement
  • Version set to 2.8

I don't think defaulting to no icon is the right approach (current widget users display will change) but I also agree about the inline styles. If we remove them it would require CSS which themes would have to support. Is there anyway the output can be the same but still allow it to be overridden with CSS and a CSS background image to replace the existing icon?

6 years ago

#2 @prateek312
6 years ago

Please review it.

#3 @prateek312
6 years ago

  • Keywords has-patch added; needs-patch removed

#4 @SergeyBiryukov
6 years ago

As noted in comment:1, defaulting to no icon is not the right approach.

this makes it hard to style (even more that the parent anchor has the same css class as following title, so you can't even hide it without some css3 only magic (:first)

This works for me:

.widget-title .rsswidget > img {
	display: none;

We could probably add a specific class for easier targeting. Otherwise, this seems like a wontfix.

#5 @SergeyBiryukov
6 years ago

  • Milestone changed from Awaiting Review to 4.2

Moving to 4.2 to make a decision.

This ticket was mentioned in Slack in #core by drew. View the logs.

5 years ago

#7 @DrewAPicture
5 years ago

  • Keywords needs-refresh added
  • Milestone changed from 4.2 to Future Release

Hi @prateek312: Thanks for the patch. At this point and time, it looks like it needs to be refreshed because of other code changes in that file, and it should be generated from the WordPress root.

Too late for this in 4.2.

#8 @wonderboymusic
5 years ago

  • Milestone changed from Future Release to 4.4

#9 @wonderboymusic
5 years ago

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

In 34683:

RSS Widget: add a class, rss-widget-icon, to the RSS icon to allow devs to hide it. Not going to remove to not break visual BC.

Fixes #22010.

Note: See TracTickets for help on using tickets.