Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions easy-recent-posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: An easy-to-use WordPress widget and shortcode to add recent posts to any theme.
* Author: Christopher Ross
* Author URI: https://thisismyurl.com/
* Version: 26.6147
* Version: 26.6148.2110
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: easy-recent-posts
Expand All @@ -20,7 +20,7 @@
}

define( 'THISISMYURL_EREP_NAME', 'Easy Recent Posts' );
define( 'THISISMYURL_EREP_VERSION', '26.6147' );
define( 'THISISMYURL_EREP_VERSION', '26.6148.2110' );
define( 'THISISMYURL_EREP_FILENAME', plugin_basename( __FILE__ ) );
define( 'THISISMYURL_EREP_FILEPATH', plugin_dir_path( __FILE__ ) );
define( 'THISISMYURL_EREP_URL', plugin_dir_url( __FILE__ ) );
Expand Down Expand Up @@ -223,16 +223,20 @@ public function easy_recent_posts( $options = null ) {

if ( 1 === (int) $options['include_link'] ) {
$rel = ( 1 === (int) $options['nofollow'] ) ? ' rel="nofollow noopener noreferrer"' : '';
// No title attribute: it would duplicate the visible link text and cause
// doubled screen-reader announcements (WCAG 2.4.4 / 4.1.2).
$item = sprintf(
'<span class="title-link"><a href="%s" title="%s"%s>%s</a></span>',
'<span class="title-link"><a href="%s"%s>%s</a></span>',
esc_url( get_permalink( $recent_post->ID ) ),
esc_attr( get_the_title( $recent_post->ID ) ),
$rel,
$item
);
}

if ( 1 === (int) $options['feature_image'] && has_post_thumbnail( $recent_post->ID ) ) {
// Alt text is controlled by the attachment's own alt-text field
// (Media Library > Alternative Text); WP core emits it here. A post
// with a decorative thumbnail should set an empty alt on the attachment.
$item = sprintf(
'<div class="thumbnail">%s</div>%s',
get_the_post_thumbnail( $recent_post->ID, 'thumbnail' ), // Escaped internally by WP core.
Expand Down
6 changes: 5 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Tags: recent posts, recent, sidebar, widget
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 26.6147
Stable tag: 26.6148.2110
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Expand All @@ -30,6 +30,10 @@ Features:

== Changelog ==

= 26.6148 =
* Accessibility: removed redundant `title` attributes from recent-post links and the widget credit link; they duplicated the visible link text and caused doubled screen-reader announcements (WCAG 2.4.4 / 4.1.2).
* Documented that featured-image alt text is controlled by the attachment's Alternative Text field.

= 26.6147 =
* Unified plugin versioning to the x.Yddd calendar-version scheme.
* Confirmed compatibility with WordPress 7.0.
Expand Down
5 changes: 3 additions & 2 deletions widgets/class-thisismyurl-easy-recent-posts-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,11 @@ public function widget( $args, $instance ) {
$title = ! empty( $instance['title'] ) ? $instance['title'] : '';

if ( 1 === (int) $instance['show_credit'] && $title ) {
// No title attribute: it would duplicate the visible link text and cause
// doubled screen-reader announcements (WCAG 2.4.4 / 4.1.2).
$title = sprintf(
'<a href="%s" title="%s">%s</a>',
'<a href="%s">%s</a>',
esc_url( 'https://thisismyurl.com/downloads/easy-recent-posts/' ),
esc_attr__( 'Easy Recent Posts', 'easy-recent-posts' ),
esc_html( $title )
);
} elseif ( $title ) {
Expand Down