• Resolved Mark Cutting

    (@mcutting)


    Is there a shortcode that shows the amount of times a post has been viewed ? I can find one for pages, but this doesn’t provide what I want. I have a function that does something similar, but I need to use a shortcode in this instance.

    The code I have is as follows

    wp_statistics_pages( 'total', "", $post->ID )

    To give you some idea.

    Thanks

    https://www.ads-software.com/plugins/wp-statistics/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Greg Ross

    (@gregross)

    [pagevisits] does the same as the function you listed, you can add an ID if you have one as well as an optional paramter, like:

    [pagevisits id=23]

    Thread Starter Mark Cutting

    (@mcutting)

    Thanks Greg. What if the ID is dynamic – for example, I don’t know which post the user will read, but need to insert the short code into another plugin which can embed content ?

    My thoughts with the existing shortcode is that it may not do what I am looking for ?

    Regs

    Plugin Contributor Greg Ross

    (@gregross)

    If you don’t include the id value, it will pick the id value of the current page. As long as the other plugin embeds within the WordPress loop it should be fine.

    However if it embeds with a iframe or something else, it may not work and that plugin would have to provide a way to identify which page it was working on.

    Thread Starter Mark Cutting

    (@mcutting)

    Thanks Greg. Much appreciated.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Shortcode – how many times post viewed ?’ is closed to new replies.