[Support request] How to insert post views to homepage ?

Home Forums Support [Support request] How to insert post views to homepage ?

Home Forums Support How to insert post views to homepage ?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #314789
    Oumar

    Hello !

    I have installed GeneratePress and I would like to integrate the view names in the excerpts of articles, just after the date of publication, on the homepage. Do you know where I can insert the shortcode or the PHP function to display the number of views on the snippets on the home page?

    Plugin: Post Views Counter https://en.wordpress.org/plugins/post-views-counter/
    Shortcode: [post-views]
    PHP Cod: <? Php echo do_shortcode (‘[post-views]’); ?>

    #314853
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    You could use this hook:

    add_action( 'generate_after_entry_title', 'tu_post_views', 15 );
    function tu_post_views() {
        echo do_shortcode( '[post-views]' );
    }
    #753880
    andriansah

    Hi tom
    Sorry for reply this old post, but can I have it without plugin?
    I want to know how many view this post get, just from the admin site.

    Thanks

    #753953
    Leo
    Staff
    Customer Support

    Nothing built-in so a plugin is required unfortunately.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.