Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author dFactory

    (@dfactory)

    Post excerpts do not execute shortcodes by default.

    If you feel comfortable enough with PHP you could add a function to run in your theme files.

    Otherwise try googling for shortcodes in excerpt.

    Hi Chrisbrownppc

    1) Locate:

    <div class=”post-info”><span class=”theauthor”><?php the_author_posts_link(); ?></span> | <span class=”thetime”><?php the_time( get_option( ‘date_format’ ) ); ?></span></div>

    in index.php

    2) Change to:
    <div class=”post-info”><span class=”theauthor”><?php the_author_posts_link(); ?></span> | <span class=”thetime”><?php the_time( get_option( ‘date_format’ ) ); ?> | <?php echo do_shortcode(‘[post-views]’); ?></span></div>

    3) Update file

    Done…. check it out at https://www.noticiero247.com

    Thanks, it is working great too on https://factwide.com

    One question, the short code is working good, except, I only want to output the number and not the whole styling and other types of html or css. Because tight now, it seems to be outputting more than just the number even though i removed all styling, classes and everything else in the post views counter “display”

    Thank you!

    Plugin Author dFactory

    (@dfactory)

    Then just use pvc_get_post_views – you’ll get a veiws count as a plain number. Then yo ucan style the output the way you prefer.

    If you look into functions.php file in the plugin, you’ll find other ways to do adjust the output – with filter hooks.

    How do I add this to my template? Like this:

    <?php echo pvc_get_post_views() ?>

    Thanks!

    Plugin Author dFactory

    (@dfactory)

    Yes, like that.

    But you might also pass post id as a parameter, if needed:

    <?php echo pvc_get_post_views( $post->ID ) ?>

    Works perfectly, thank you!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Display the View Counter in the post summary/excerpt.’ is closed to new replies.