Oliver Baty. Details are here.
Version: 0.1
Author: Favio Manriquez
Author URI: http://blog.favrik.com
Copyright 2007 Favio Manriquez (email : favio@favrik.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
Most important configuration variable is $group:
0 - Just put the date at the left side.
1 - Group by year, month, and day.
*/
function favrik_recent_posts($args = '') {
global $wp_locale, $wpdb;
// params fun
parse_str($args, $r);
$defaults = array('group' => '1', 'limit' => '10', 'before' => '', 'after' => ' ', 'show_post_count' => false, 'show_post_date' => true, 'date' => 'F jS, Y', 'order_by' => 'post_date DESC');
$r = array_merge($defaults, $r);
extract($r);
// output
$output = '';
$pre = '';
$full_date = '';
$year = '';
$month = '';
$day = '';
// the query
$where = apply_filters('getarchives_where', "WHERE post_type = 'post' AND post_status = 'publish'");
$join = apply_filters('getarchives_join', "");
$qry = "SELECT ID, post_date, post_title, post_name
FROM $wpdb->posts $join
$where ORDER BY $order_by LIMIT $limit";
$arcresults = $wpdb->get_results($qry);
if ($arcresults) {
foreach ($arcresults as $arcresult) {
if ($arcresult->post_date != '0000-00-00 00:00:00') {
$url = get_permalink($arcresult);
if ($group == 0) { // dates at the side of the post link
$arc_date = date($date, strtotime($arcresult->post_date));
$full_date = '' . $arc_date . ' ';
}
if ($group == 1) { // grouping by year then month-day
$m = date('F Y', strtotime($arcresult->post_date));
$y = date('Y', strtotime($arcresult->post_date));
if ($month != $m) {
$month = $m;
$pre .= '
' . substr($month, 0, -4) . $y.'
'; } $d = date('jS', strtotime($arcresult->post_date)); if ($day != $d) { $day = $d; $full_date = '' . $day . ''; } } if(has_category('fbknews', $arcresults)) { $output .= $pre; $output .= get_the_archive_post($arcresult->ID); $pre = ''; $full_date = ''; } } } } echo $output; } function get_the_archive_post($id) { query_posts('p='.$id); while ( have_posts() ) : the_post(); if(get_option('use_thumb_script') == "No") { $thumbscript = 'width="184" height="auto"'; } $post .= '';
return $post;
endwhile; wp_reset_query();
}
?>