Answer the question
In order to leave comments, you need to log in
How to change the icon in wordpress child theme?
Hello.
In the main theme on wordpress 4.9.8 there is a theme/includes/functions.php file, which has a post view counter function -
function theme_get_post_views_count_html( $args = array() ) {
$r = wp_parse_args( $args, array(
'class' => '',
'post_id' => get_the_ID(),
) );
$views_count = theme_get_views_count( absint( $r[ 'post_id' ] ) );
if( theme_is_view_count_tresholded( $views_count ) ) {
return;
}
$class = 'post-meta-item post-views' . ( $r[ 'class' ] ? sprintf( ' %s', $r[ 'class' ] ) : '' );
$icon = 'bb-ui-icon-eye';
return sprintf( '<span class="%s"><span class="bb-icon ' . $icon . '"></span><span class="count">%s</span><span class="txt">%s</span></span>', $class, $views, _n( 'view', 'views', $views_count, 'theme' ) );
}
Answer the question
In order to leave comments, you need to log in
In the child theme, create the function child_theme_get_post_views_count_html . Change it as necessary.
Copy all parent theme files that use the theme_get_post_views_count_html call . Replace with calling child_theme_get_post_views_count_html
For me, it's better to combine everything, and then calculate. Something like this (possible syntax errors):
SELECT COUNT(*) AS count
FROM orders o
JOIN order_comments oc ON o.id = oc.order_id
JOIN order_comment_views ocv ON ocv.comment_id = oc.id
WHERE o.id =286 AND ocv.user_id =1
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question