WordPress.org

Ready to get started?Download WordPress

Forums

hitcounter
Must be inside the loop (4 posts)

  1. tobifjellner
    Member
    Posted 3 years ago #

    As far as I understand, this plugin keeps track of how many times a post has been shown, and it won't differentiate between shows of just the beginning of the post (in a list view) or the full content. (Hint to developers, you're already differentiating between different viewers reg/unreg/bots, why not also differentiate between type of views short/full?)

    Before I realized what the plugin counts and how, I tried to show the tag php userViews() in a page footer widget. In order to make sense, it must be located in a place, which is clearly attributable to a single post. So I believe it needs to be inside the loop.

    http://wordpress.org/extend/plugins/hitcounter/

  2. Tom(dB)
    Member
    Posted 3 years ago #

    Hi tobifjellner. Yes, the userViews must appear within the loop because it acts on the post id of the current post.

    I'm not entirely sure what you mean by

    differentiate between type of views short/full?)
    Do you mean to count if a view is the_excerpt() or the_content()?

    The plugin originally acted upon the_content() and caused problems for many people so it also seemed to fire on the_excerpt() if no excerpt was written in (i.e. the excerpt box was left blank within the post writing page). Now the function fires on the_post.

    Any suggestions for functionality are welcome, though I don't want it to become bloated.

  3. tobifjellner
    Member
    Posted 3 years ago #

    --differentiate between type of views short/full?)--
    Do you mean to count if a view is the_excerpt() or the_content()?

    I'm using the pseudo-tag "more" a lot.
    This way, only the first couple of paragraphs is visible in list views, and then the visitor has to click on "read more" to see the full post.

    I don't know if it would be possible to distinguish between views in "list format" vs. "full post". If yes, then it would be useful. :)

  4. TadeuszD
    Member
    Posted 2 years ago #

    Hello, Tom.

    Now the function fires on the_post.

    A year has passed... I upgraded your plugin from 1.2 to 1.3 and I encountered an error.
    In my page I use more than one post loop in single.php template. The first loop display the main post content, the second loop lists the titles of posts matching the category (for simple navigation only). In this case the plugin counts every post listed in template.
    I corrected this error by replacing add_filter('the_post', 'detectAgent') with add_filter('the_content', 'detectAgent');

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic