Nội dung Thông tin Bài đăng mặc định trong Bài đăng Nổi bật của Genesis là:
[post_date] By [post_author_posts_link] [post_comments]
Hướng dẫn này cung cấp các bước để thay thế các chuỗi Để lại một Bình luận / Nhận xét / Nhận xét trong đầu ra của shortcode (nếu được sử dụng) trong các tiện ích có biểu tượng lời nói bằng cách sử dụng Font Awesome.[post_comments]
Bước 1
Cài đặt và kích hoạt plugin Bộ lọc đầu ra tiện ích cho phép chúng tôi lọc đầu ra của bất kỳ tiện ích nào trong WordPress.
Bước 2
Tải phông chữ tuyệt vời.
Đi tới Genesis> Cài đặt chủ đề> Tập lệnh đầu trang và chân trang.
Dán
<script defer src="https://use.fontawesome.com/releases/v5.0.1/js/all.js"></script>
trong vùng văn bản Header Scripts.
Bước 3
Trong (các) tiện ích con Bài đăng Nổi bật, hãy thay thế
[post_date] By [post_author_posts_link] [post_comments]
với
[post_date] By [post_author_posts_link] [post_comments zero="{{{commenticon}}}" one="1 {{{commenticon}}}" more="% {{{commenticon}}}"]
Bước 4
Bây giờ, hãy thay thế tất cả các trường hợp của bằng trong đầu ra của các tiện ích Bài đăng nổi bật.{{{commenticon}}}
<i class="far fa-comment"></i>
Thêm phần sau vào functions.php của chủ đề con :
add_filter( 'widget_output', 'filter_widgets', 10, 4 );
/**
* Replace `{{{commenticon}}}` with HTML for a comment icon in Genesis Featured Posts widgets.
*
* @param string $widget_output The widget's output.
* @param string $widget_type The widget's base ID.
* @param string $widget_id The widget's full ID.
* @param string $sidebar_id The current sidebar ID.
*
* @return string Modified widget's output.
*/
function filter_widgets( $widget_output, $widget_type, $widget_id, $sidebar_id ) {
if ( 'featured-post' === $widget_type ) {
$widget_output = str_replace( '{{{commenticon}}}', '<i class="far fa-comment"></i>', $widget_output );
}
return $widget_output;
}