Posts in Sidebar 4.7.1 bugfix release

Today I released a new version of Posts in Sidebar that fixes a couple of bugs. Many thanks to @mlang38 for reporting it on GitHub:

in the commit 1c4dfef, the widget title has been wrapped with esc_html().
But I think (and I do it myself) that the widget_title filter is often used by themes for CSS styling purposes by wrapping the title with some targetable markup. If the HTML of the title is escaped, this usage is therefore broken. I think this behavior should be reverted.

By the way, the widget_title filter is called with the instance title only, but this filter accepts more arguments to better target the widgets to be customized.

Anyway, thank you for this very useful plugin


He was right. The escaping bug was introduced when I made a huge checkup of all the files with PHPCS. Now, this specific bug is resolved, but others could currently exist. If you see something strange, please let me know by opening an issue on GitHub.

Regarding the second issue (“the widget_title filter is called with the instance title only”), this has been fixed too. Now you can customize the widget titles of this plugin in your themes/plugins. An example is the following:

function pis_change_widget_title( $title, $instance = array(), $id_base = '' ) {
	if ( 'pis_posts_in_sidebar' === $id_base ) {
		$title = 'Widget: ' . $title;
	return $title;
add_filter( 'widget_title', 'pis_change_widget_title', 10, 3 );

This simple code will prepend the “Widget: ” string to all Posts in Sidebar widget titles. Obviously, this is only an example, since the filter lets you make more serious changes, like adding HTML markup to titles.

The last fixed bug is related to the plugin list page. Before this release, the plugin added a link to all plugins (except itself) for reviewing Posts in Sidebar! Sorry about this! :-)

Published by aldolat

A WordPress fanatic.