Widgets: make the Recent Posts widget output '(no title)' for posts without a title.

Since WordPress 2.3, the Recent Posts widget used to output the post ID for posts
with an empty title. Using '(no title)' seems a best option and is consistent with
what's already used in other similar cases.

Props antonrinas, Ankit K Gupta.
Fixes #35709.

Built from https://develop.svn.wordpress.org/trunk@41149


git-svn-id: http://core.svn.wordpress.org/trunk@40989 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrea Fercia 2017-07-25 16:13:45 +00:00
parent ac82a26fc5
commit de31d6f81c
2 changed files with 2 additions and 2 deletions

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.9-alpha-41148';
$wp_version = '4.9-alpha-41149';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

View File

@ -82,7 +82,7 @@ class WP_Widget_Recent_Posts extends WP_Widget {
<ul>
<?php while ( $r->have_posts() ) : $r->the_post(); ?>
<li>
<a href="<?php the_permalink(); ?>"><?php get_the_title() ? the_title() : the_ID(); ?></a>
<a href="<?php the_permalink(); ?>"><?php get_the_title() ? the_title() : _e( '(no title)' ); ?></a>
<?php if ( $show_date ) : ?>
<span class="post-date"><?php echo get_the_date(); ?></span>
<?php endif; ?>