• 4,570 views Nov 12, 2006

    I wanted to keep track of the Alexa ranking for my blog without having to constantly visit the Alexa site. I found a plugin for this called Alexa Rank, but the plugin shows a graphical bar that you have to hover over to get the numerical value. I wanted something a bit more simple that I could better integrate into my layout (I just display the text in a list of administrative options other users don’t see). So, I hacked something together that does the job for me, maybe someone else is looking for the same type of thing.

    I used class_http.php to grab the information from Alexa, and it caches the info for 1 day (the plugin only polls Alexa once per day, if it polled on every page load, a busy site would probably end up getting banned). The rank that is displayed is linked back to the Alexa page for the URL that is being ranked.

    Installation
    To install the plugin, create a directory called ‘jpf_rank’ in your plugins folder. Extract jpf_alexa_rank.zip and copy all of the files to the jpf_rank directory. If you’ve already installed any of my other ranking plugins, then you only need to copy the jpf_alexa_rank.php file to the jpf_rank directory. Go to your Manage Plugins page and activate the plugin and you’re ready to go.

    Configuration
    To display your Alexa rank, insert the following code wherever you want to see the rank:

    <?php jpf_alexa_rank(); ?>

    The default settings assume you’re putting this in your sidebar, so it wraps the result in <li> and </li> which will display like this:
    {Note that I’m not running this plugin anymore, so there is no display here}
    If you’d like it formatted differently, here are the available parameters:

    • $before = what you want to appear before the rank number. The default is ‘<li>Alexa: ‘.
    • $blog = the URL to get the rank for. By default, the ‘home’ setting that you set in your Wordpress general settings page is used. You can enter a different one if you prefer (eg. http://sojoe.info/downloads).
    • $after = what you want to appear after the rank number. The default is ‘</li>’.

    Examples
    If you just want to display the rank number inline with other text, like this: {Note that I’m not running this plugin anymore, so there is no display here}, use the following:

    <?php jpf_alexa_rank (”,”,”); ?>

    Name: JPF Alexa Rank WordPress Plugin [Download]
    Size: 5,00 kBytes
    FileType: .zip-File
    Edited on 03. Mar 2007 - 15:46 h
    Downloads: 523
    Free for visitors

    Tags:

  • 3 Responses

    WP_Modern_Notepad

    Leave a Comment

    Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.