Help please use the font style "genericons" for the word " views " in the meta
-
Hello! I do not speak English and I use a translator to communicate with you.
On my site, set your theme ?morphic?, now the question arose. I can not specify the font style to display it in counting the number of page views. You are in the design theme used fonts ?Genericons?, I can not prescribe the style to display the icon .genericon-show \ f403. How can I do that?
I want to add the word “views” this style and bring it into this code
<div class=”entry-meta”>
<?php nuthemes_posted_on(); ?>
<?php if ( ! post_password_required() && ( comments_open() || ‘0’ != get_comments_number() ) ) : ?>
<span class=”comments-link”><?php comments_popup_link( __( ‘Leave a comment’, ‘nuthemes’ ), __( ‘1 Comment’, ‘nuthemes’ ), __( ‘% Comments’, ‘nuthemes’ ) ); ?></span><span class=”views”> Просмотры: <?php echo get_post_meta ($post->ID,’views’,true); ?></span>
<?php endif; ?>
<!– .entry-meta –></div>The code to display output:
<?php echo get_post_meta ($post->ID,’views’,true); ?>Here’s the code that creates the function of ” Views “:
/ * Count the number of visits pages * /
add_action(‘wp_head’, ‘postviews’);
function postviews() {
/ * Settings * /
$meta_key = ‘views’;// The key meta fields where views will be recorded .
$who_count = 1;// Whose visits count? 0 – All. 1 -Guests . 2 -zaregistrirovanyh users.
$exclude_bots = 1;// Exclude Bots : 0 – no . 1 – yes.
/ * Settings * /
global $user_ID, $post;
if(is_singular()) {
$id = (int)$post->ID;
static $post_views = false;
if($post_views) return true; //1 time for the flow
$post_views = (int)get_post_meta($id,$meta_key, true);
$should_count = false;
switch( (int)$who_count ) {
case 0: $should_count = true;
break;
case 1:
if( (int)$user_ID == 0 )
$should_count = true;
break;
case 2:
if( (int)$user_ID > 0 )
$should_count = true;
break;
}
if( (int)$exclude_bots==1 && $should_count ){
$useragent = $_SERVER[‘HTTP_USER_AGENT’];
$notbot = “Mozilla|Opera”;
$bot = “Bot/|robot|Slurp/|yahoo”;
if ( !preg_match(“/$notbot/i”, $useragent) || preg_match(“!$bot!i”, $useragent) )
$should_count = false;
}
if($should_count)
if( !update_post_meta($id, $meta_key, ($post_views+1)) ) add_post_meta($id, $meta_key, 1, true);
}
return true;
}I want to bring in the entry-meta icon “Eye ? (\ f403) next to the word “View” next to the word will be displayed number posischeny . how to do it?
I want to have kind of code :
<div class=”entry-meta”>
<?php nuthemes_posted_on(); ?>
<?php if ( ! post_password_required() && ( comments_open() || ‘0’ != get_comments_number() ) ) : ?>
<span class=”comments-link”><?php comments_popup_link( __( ‘Leave a comment’, ‘nuthemes’ ), __( ‘1 Comment’, ‘nuthemes’ ), __( ‘% Comments’, ‘nuthemes’ ) ); ?></span><span class=”views”> View: <?php echo get_post_meta ($post->ID,’views’,true); ?></span>
<?php endif; ?>
<!– .entry-meta –></div>Before the word ” views ” should stand icon . The word ” Views ” icon and must have one style that is registered for the entry-meta.
I would be grateful if you will not refuse to help. I say thank you in advance for the help !
- The topic ‘Help please use the font style "genericons" for the word " views " in the meta’ is closed to new replies.