Views counter

Tuesday, October 10th, 2006 - Español English

I just installed the view-count plugin by Mike O’Connell. As one would expect, it’s a very simple plugin. On the first run it ALTERs the posts table adding a BIGINT view_count column which is updated when users click on a post. To display the number of views, one has just to call the_view_count() at some place in the template. I’ll add it one day… ;)

Alas, the counter never gets updated… the filters installed by the plugin never get called, since expects filter single_template to be applied somewhere during template rendering, but that filter name doesn’t even exist in my ancient wordpress version. I just added

if(is_single() || is_page())
apply_filter('single_template', $content);

to wp-includes/template-functions-post.php, function the_content() and it works now. I hope that as it should ;)

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>