Error 

Archive for August 12th, 2006

Wordpress Post Popularity

Posted August 12, 2006 at 10:08pm in Computers, Programming, Wordpress

For anyone wanting a popularity ranking for Wordpress posts that are also using the WP-Postviews plugin this is a solution. It isn’t the best version, but it does what I want. Someone has already created a popularity plugin, but it did not work for me and taking the time to make it work could not be justified.

$int_tpop = 0;
the_pop();

function the_pop() {
        global $wpdb, $int_tpop;
        $total_views = $wpdb->get_row("
                SELECT SUM(meta_value) as tviews
                FROM wp_postmeta WHERE meta_key = 'views'"
);
        $int_tpop = $total_views->tviews;
}

function return_pop ($views = 0, $total = 0) {
        $formatted = number_format((($views/$total)*100), 1, '.', ");
        $out = $formatted;
        echo ' <b>&middot;</b> '.$out.'% Popularity';
}

Enter this where you would like the popularity to be displayed.
<?php return_pop(trim(the_views(",FALSE)),$int_tpop) ?>

I placed the above code into my header template file and placed the last line of code in my post display file. If you have any problems please let me know.

The Cheetah goes GRRRRR

Posted August 12, 2006 at 12:08am in Computers, Programming

I started playing with Cheetah tonight and as of right now I hate it. Not for the system itself but because I can’t get the shit to work. I keep getting errors and cannot find solutions to them. I have tried running examples people have put online and they don’t work either. I am about to just give up on it because there are other templating systems that will give me less headache. And after giving this post the title I did I want that toy with the pull string that tells you what noise the animal makes.

The Pete goes NIGHT