I have the following code to display my most popular posts in the sidebar:
{popularposts}
{if $pposts != ''}
<h2>Most Popular Posts</h2>
<ul>
{foreach from=$pposts key=key item=hits}
<li><nobr><a href="{get_permalink id=$hits.postID}" title="{$hits.title}">{$hits.title|truncate:25:"..."}</a>: {$key}</nobr></li>
{/foreach}
</ul>
{/if}
However, it doesn’t work: the links are all to the least recent of my recent posts the last post on the page.
I’ll have to fix this.
(Note: a fix is in the comments).
Hello, I have had the same problem but solved it by using this code :
<a href="{$siteurl}{$hits.url}" title="{$hits.title}">{$hits.title|truncate:20:".."}{$key}
instead of :
{get_permalink id=$hits.postID}
and it works fine for me.
Hope it helps.
Apologize for my poor english writing.
7 hours, 30 minutes after the fact.
Thanks!
Actually, I had to remove the $siteurl one to work on mine!
9 hours, 12 minutes after the fact.