Aug 06 2008

Hardcoding Firestats 5 Most Popular Posts into your Sidebar

Published by firefly at 4:52 pm under Wordpress and tagged: , , ,

To display your 5 most popular posts, simply copy and paste this code into your sidebar.php of your chosen theme. Make sure Firestats is enabled in your plug-in section.

This is mainly for hardcoding themes into Wordpress MU, since there is an existing widget that does the same job in 5 seconds flat.

<?php if ( function_exists(’fs_get_firestats_path’) )
{
echo<li>;
echo<h2>5 Most Popular Posts</h2>;
 
$FS_PATH = fs_get_firestats_path();
require_once($FS_PATH./php/html-utils.php’);
$days_ago = 30;
$num_to_show =5;
$generator =  create_function(,return fs_get_popular_pages_tree($num_to_show, $days_ago, FS_URL_TYPE_POST,false, null););
echo fs_get_cached_data(’cached_firestats_popular_pages’, $generator, 3600);
}
?>
Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Reddit
  • Digg
  • StumbleUpon
  • del.icio.us




3 Responses to “Hardcoding Firestats 5 Most Popular Posts into your Sidebar”

  1. [...] Firestats.  Omry, the creator of Firestats patiently helped me hand-code the fancy widget on the right saying “5 Most Popular Posts”.  It references the excellent plug-in Firestats, which works perfectly with Wordpress MU.  The code to do this is here. [...]

  2.   j UNITED STATESon 13 Aug 2008 at 3:48 am

    in my opinion, the sidebar has a bit too much in it. 2 columns is one to many, especially with all the empty space you already have on each side.

  3.   firefly JAPANon 13 Aug 2008 at 10:25 am

    I can see how it would look a bit much, but it’s for a reason. The left sidebar is hardcoded so every blog has the same feeds/links, and so bloggers can see a community grow from their posts.

    The right right column is a mix between hardcoded and dynamic, so savvy Japan bloggers can customise their sidebar.

    Thanks for the comment !

Trackback URI | Comments RSS

Leave a Reply

  • Your-Japan Main Site


  • Return to Your-Japan.com