Skip to content

Commit 41b489f

Browse files
committed
Fix wpautop for author description
1 parent 542a36d commit 41b489f

File tree

2 files changed

+13
-20
lines changed

2 files changed

+13
-20
lines changed

archive.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<?php do_action( 'bootscore_before_title', 'archive' ); ?>
3030
<?php the_archive_title('<h1 class="entry-title ' . apply_filters('bootscore/class/entry/title', '', 'archive') . '">', '</h1>'); ?>
3131
<?php do_action( 'bootscore_after_title', 'archive' ); ?>
32-
<?= bootscore_archive_description(); ?>
32+
<?php the_archive_description( '<div class="archive-description ' . apply_filters('bootscore/class/entry/archive-description', '') . '">', '</div>' ); ?>
3333
</div>
3434

3535
<?php do_action( 'bootscore_before_loop', 'archive' ); ?>

inc/template-tags.php

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,6 @@
1414
defined('ABSPATH') || exit;
1515

1616

17-
/**
18-
* Gets filtered archive description with consistent HTML wrapper
19-
*/
20-
function bootscore_archive_description() {
21-
$description = get_the_archive_description();
22-
if (empty(trim($description))) {
23-
return '';
24-
}
25-
26-
// Strip only outer <p> tag
27-
$description = preg_replace('#^<p[^>]*>(.*?)</p>$#s', '$1', $description);
28-
29-
// Get filtered class
30-
$class = trim(apply_filters('bootscore/class/entry/archive-description', 'archive-description '));
31-
32-
return '<p class="' . esc_attr($class) . '">' . $description . '</p>';
33-
}
34-
35-
3617
/**
3718
* Category Badge
3819
*/
@@ -142,6 +123,18 @@ function bootscore_author() {
142123
}
143124

144125

126+
/**
127+
* Fix wpautop in author description archive.php
128+
* See https://github.com/bootscore/bootscore/pull/1017
129+
*/
130+
add_filter('get_the_archive_description', function ($description) {
131+
if (is_author()) {
132+
return wpautop($description);
133+
}
134+
return $description;
135+
});
136+
137+
145138
/**
146139
* Comments
147140
*/

0 commit comments

Comments
 (0)