fix: line break exceptions

pull/506/head
n0099 2022-04-27 18:21:46 +08:00 committed by GitHub
parent 0c7bd0a42e
commit 19b2118573
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -298,7 +298,7 @@ class widget_about extends WP_Widget
{ {
$introduce = !empty(get_the_author_meta('description', '1')) ? get_the_author_meta('description', '1') : __('这个人很懒,什么都没留下', 'kratos'); $introduce = !empty(get_the_author_meta('description', '1')) ? get_the_author_meta('description', '1') : __('这个人很懒,什么都没留下', 'kratos');
$username = get_the_author_meta('display_name', '1'); $username = get_the_author_meta('display_name', '1');
$avatar = get_avatar_url('1'); $avatar = get_avatar_url('1', ['size' => '300']);
$background = !empty($instance['background']) ? $instance['background'] : ASSET_PATH . '/assets/img/about-background.png'; $background = !empty($instance['background']) ? $instance['background'] : ASSET_PATH . '/assets/img/about-background.png';
echo '<div class="widget w-about">'; echo '<div class="widget w-about">';
@ -314,6 +314,7 @@ class widget_about extends WP_Widget
if (kratos_option('g_login', true)) { if (kratos_option('g_login', true)) {
echo '</a>'; echo '</a>';
} }
$introduce = str_replace("\n", '<br>', $introduce);
echo '</div><div class="textwidget text-center"><p class="username">' . $username . '</p><p class="about">' . $introduce . '</p></div>'; echo '</div><div class="textwidget text-center"><p class="username">' . $username . '</p><p class="about">' . $introduce . '</p></div>';
echo '</div>'; echo '</div>';
} }