in Blog
\astra\inc\blog\blog.php
326 line에 다음을 삽입할 것
<!-- .post view count -->
<br><span id='view_count' class="highlight"> <?php echo do_shortcode( '' ); ?> </span><br>
<!-- .post view count end -->
※ 위 쇼코드 내의 ‘jp_post_view’이 bbpress에서는 ‘[‘ ‘]’ 불어로 안 보임
in bbPress
astra-child/bbpress/content-single-topic.php
16 line에 다음을 삽입할 것
<span style="color: white;background-color: #4a89c3;"> <?php echo do_shortcode( '' ); ?> </span>
※ 위 쇼코드 내의 ‘jp_post_view’이 bbpress에서는 ‘[‘ ‘]’ 불어로 안 보임
전체적인 통제는 post-views-for-jetpack 플러그인에서
/**
* Create a shortcode to display a post view inside a post.
* Shortcode format is
*
* @since 1.0.0
*
* @return string $view Total number of views for that post.
*/
function jp_post_views_display() {
// Get the post ID.
$post_id = get_the_ID();
if ( ! isset( $post_id ) || empty( $post_id ) ) {
return;
}
// Get the number of views for that post.
$views = jp_post_views_get_view( $post_id );
$num_s = preg_replace("/[^0-9]*/s", "", $views['total']);
if ( $num_s < 30 ) { return; }
if ( isset( $views ) && ! empty( $views ) ) {
$view = sprintf(
esc_html(
_n(
'%s view',
' 👁 %s'.'명의 독자가 공감하셨습니다',
$views['total'],
'post-views-for-jetpack'
)
),
number_format_i18n( $views['total'] )
);
} else {
$view = esc_html__( 'no views', 'post-views-for-jetpack' );
}
/**
* Filter the output of the shortcode.
*
* @since 1.0.0
*
* @param string $view Phrase outputting the number of views.
* @param array $views Number of views.
* @param string $post_id Post ID.
*/
return apply_filters( 'jp_post_views_output', $view, $views, $post_id );
}