Post counter and Most visited post for WordPress 1.2

July 28th, 2004
WordPress Hack

There are some changes in order for that hack of mine. This hack counts the number of times users click on a certain permalink and then allows the creation of a “Most Popular Posts” list. This was written for WordPress 1.0 and now has been modified for WordPress 1.2 Mingus.

You can see how it works on this blog and can download the instructions from here:




  1. Sushubh (3 comments.) says:

    Dude… A plugin???

  2. Mark (7 comments.) says:

    Yes, it should be a plugin, so shoot me! ;)

  3. Felixe (1 comments.) says:

    I’m stuck with step 3

    3) Now open your index.php and find this line:
    < ?php } } else { // end foreach, end if any posts ?>

    I can’t find that line in a almost-standard WP 1.2 Mingus installation. I suppose it’s neer the end of The Loop but not quite sure.

    Thank you.

  4. Sherri (10 comments.) says:

    My comment didn’t post (I’m testing with this one).

  5. Sherri (10 comments.) says:

    Well, it must not have liked my long urls, even though I put them in CODE.

    pop_posts() is showing the entire archive url with $siteurl, followed by the &p=217&more=1&c=1 query looking url after the index.php part. So if I have an archive like
    then the $siteurl turns out to be

    I can’t figure out how to get the $siteurl to NOT included the entire archive permalink url. But looking at yours on this blog, I see that yours has the pretty permalinks, and none of that query business stuff. I want mine like yours, with properly working, pretty links, not wonky query links that go nowhere LOL

  6. Podz (11 comments.) says:

    Using the latest CVS, putting the index.php line just below:
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    does the trick :)

  7. Philip Peeples (1 comments.) says:

    I have implemented this post view counter prior to using permalinks. I have found a couple plugins now that I would like to implement, but they require permalinks. If I enable permalinks, the post view counter no longer counts the post views.

    This site seems to have implemented it properly. Can someone post a revised code that works with permalinks? Thanks in advance for your help!


  1. […] feedback, I’ve implemented Mark’s code for tracking visited posts and listing popular posts. Woo exciting yeah? Well no […]

  2. […] __ __Most popular__

  3. […] é¤Ë³Æµ­»ö¤Ëˬ¤ì¤¿²ó¿ô¤òɽ¼¨¤¹¤ëHACK¤Ç¤¹¡£ http://weblogtoolscollection.c.....dpress-12/” title=”Post counter and Most visited post for W […]

  4. WordPress单篇日志点击数统计
      在Weblog Tools Collection那里看到一个名为Post counter and Most visited post for WordPress 1.2çš„Hack,Mark终于把这个Hack给放出来了,因为Weblog Tools Collection很早就开始使用这个Hack了。现在就来说说我的安…

  5. […] ¤Ç±ÜÍ÷¿ô¤Î¥«¥¦¥ó¥ÈÊýË¡¤¬Benjamin¤µ¤ó¤¬¤³¤Á¤é¤Ç²òÀ⤵¤ì¤Æ¤¤¤¿¤Î¤Ç¡¢Æ³Æþ¤·¤Æ¤ß¤Þ¤·¤¿¡£ ¤Þ¤º¡¢Post counter and Most visited p […]

Obviously Powered by WordPress. © 2003-2013

page counter