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.


git-svn-id: https://develop.svn.wordpress.org/trunk@41149 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrea Fercia
2017-07-25 16:12:29 +00:00
parent 5de0d45b90
commit 765445ee61

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; ?>