Most Popular Posts

I’ve just added a new plugin to the site that lists the most popular posts on your blog.
The command is {popularposts} which creates an array, $pposts, containing the list of posts. Unfortunately it’ll only work if you use the newer $blogid/archives/p/1/ type url, not the old $blogid/archives/m/200407/#1
Thank you Nargler for the MySQL substring_index code. Helped a lot!

Here’s an example usage:

{popularposts}
{if $pposts != ''}
  <b>Most Popular Posts</b><br />
  {foreach from=$pposts key=key item=hits}
    <nobr><a href="{$siteurl}/archives/p/{$hits.postID}/c/1/more/1" title='{$hits.title}'>{$hits.title|truncate:30:"..."}</a>: {$key}</nobr><br />
  {/foreach}
{/if}

One thought on “Most Popular Posts

  1. hi there. im lookin’ for something like this, but will need a bit more info to get it running. can you help me? are you on IM? do i need to download the plugin you mentioned or is that code snip the whole thing? thx, kk+

Leave a Reply

%d bloggers like this:

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close