WordPress.org

Ready to get started?Download WordPress

Forums

WordPress Popular Posts
[resolved] View count empty on Custom Post Types (5 posts)

  1. Jonathan Wold
    Member
    Posted 4 years ago #

    I'd like to track views on custom post types using "wpp_get_views()". I noted this post by "learnthat" which offered some good clues, but applies to Widgets, which I'm not using.

    Any suggestions?

  2. Héctor Cabrera
    Member
    Plugin Author

    Posted 4 years ago #

    Hi Jonathan,

    Actually, the wpp_get_views method queries the wpp_popularpostsdata table to get the views count of a given post ID. The post type isn't really neccesary here.

    Are you sure that you're passing a valid ID to the function?

  3. Jonathan Wold
    Member
    Posted 3 years ago #

    I've tried:
    <?php wpp_get_views($post->ID); ?>

    And:
    <?php wpp_get_views('17'); ?> (Targetting a specific post)

    To no apparent avail.

  4. Héctor Cabrera
    Member
    Plugin Author

    Posted 3 years ago #

    You need to echo it, my friend ;)

    <?php echo wpp_get_views($post->ID); ?>

  5. Jonathan Wold
    Member
    Posted 3 years ago #

    ..Nice :)

    Thank you for pointing that out!

    It works beautifully.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic