View difference between Paste ID: gsfhLSSG and AvDu4cgZ
SHOW: | | - or go back to the newest paste.
1
<?php
2
/* Template Name: Archive */
3
get_header(); ?>
4
 
5
 
6
 
7
 
8
                <div id="insidebanner">
9
                        <?php if(get_post_meta($post->ID, 'banner_image', true)) { ?><p><img src="<?php echo get_post_meta($post->ID, 'banner_image', true); ?>" alt="" /></p><?php } ?>
10
                        <h2><?php the_title(); ?></h2>
11
 
12
                        <?php if(get_post_meta($post->ID, 'banner_text', true)) { ?><p class="tagline"><?php echo stripslashes(get_post_meta($post->ID, 'banner_text', true)); ?></p><?php } ?>
13
                </div><!-- end banner -->
14
               
15
               
16
                <div id="mainarea">
17
               
18
                        <div id="contentarea" class="fullwidth archive">
19
                       
20
<?php
21
 
22
/*
23
Plugin Name: favrik Recent Posts
24
Plugin URI: http://blog.favrik.com/
25
Description: Display recent posts by date: 1) grouping by year, month,day, and 2) just the date at the left side of the title. Based on the work by <a href="http://www.ardamis.com">Oliver Baty</a>. <a href=" http://www.ardamis.com/2007/06/25/adding-the-post-date-to-wp_get_archives/">Details are here</a>.
26
Version: 0.1
27
Author: Favio Manriquez
28
Author URI: http://blog.favrik.com
29
 
30
    Copyright 2007  Favio Manriquez  (email : favio@favrik.com)
31
 
32
    This program is free software; you can redistribute it and/or modify
33
    it under the terms of the GNU General Public License as published by
34
    the Free Software Foundation; either version 2 of the License, or
35
    (at your option) any later version.
36
 
37
    This program is distributed in the hope that it will be useful,
38
    but WITHOUT ANY WARRANTY; without even the implied warranty of
39
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
40
    GNU General Public License for more details.
41
 
42
    You should have received a copy of the GNU General Public License
43
    along with this program; if not, write to the Free Software
44
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
45
*/
46
 
47
/**
48
 Most important configuration variable is $group:
49
 0      -       Just put the date at the left side.
50
 1      -       Group by year, month, and day.
51
*/
52
function favrik_recent_posts($args = '') {
53
    global $wp_locale, $wpdb;
54
 
55
    // params fun
56
    parse_str($args, $r);
57
    $defaults = array('group' => '1', 'limit' => '10', 'before' => '<li>', 'after' => '</li>', 'show_post_count' => false, 'show_post_date' => true, 'date' => 'F jS, Y', 'order_by' => 'post_date DESC');
58
    $r = array_merge($defaults, $r);
59
    extract($r);
60
   
61
    // output
62
    $output    = '';
63
    $pre       = '';
64
    $full_date = '';
65
    $year      = '';
66
    $month     = '';
67
    $day       = '';
68
 
69
    // the query
70
    $where = apply_filters('getarchives_where', "WHERE post_type = 'post' AND post_status = 'publish'");
71
    $join  = apply_filters('getarchives_join', "");
72
    $qry   = "SELECT ID, post_date, post_title, post_name
73
              FROM $wpdb->posts $join
74
              $where ORDER BY $order_by LIMIT $limit";
75
    $arcresults = $wpdb->get_results($qry);
76
    if ($arcresults) {
77
        foreach ($arcresults as $arcresult) {
78
            if ($arcresult->post_date != '0000-00-00 00:00:00') {
79
                $url  = get_permalink($arcresult);
80
                if ($group == 0) { // dates at the side of the post link
81
                    $arc_date = date($date, strtotime($arcresult->post_date));
82
                    $full_date = '<em class="date">' . $arc_date . '</em> ';
83
                }
84
                if ($group == 1) { // grouping by year then month-day
85
                    $m = date('F Y', strtotime($arcresult->post_date));
86
                    $y = date('Y', strtotime($arcresult->post_date));
87
                    if ($month != $m) {
88
                        $month = $m;
89
                        $pre .= '</div><div class="archivebox"><h2 class="archivemonth">' . substr($month, 0, -4) . $y.'</h2>';
90
                    }
91
                    $d = date('jS', strtotime($arcresult->post_date));
92
                    if ($day != $d) {
93
                        $day = $d;
94
                        $full_date = '<em>' . $day . '</em>';
95
                    }
96
                }
97
98-
		if(has_category('FBKNews', $arcresults)) {
98+
		if(has_category('fbknews', $arcresults)) {
99
	                $output .= $pre;
100
        	        $output .= get_the_archive_post($arcresult->ID);
101
        	        $pre = ''; $full_date = '';
102
		}
103
            }
104
        }
105
    }
106
    echo $output;
107
}
108
 
109
 
110
 
111
 
112
function get_the_archive_post($id) {
113
        query_posts('p='.$id); while ( have_posts() ) : the_post();
114
        if(get_option('use_thumb_script') == "No") { $thumbscript = 'width="184" height="auto"'; }
115
        $post .= '<div class="post"><div class="overlay"></div><div class="entry">
116
<p><a href="'.get_permalink().'"><img src="'.get_thumbnail($id, '184', '120').'" alt="" '.$thumbscript.'/></a></p>
117
<h3><a href="'.get_permalink().'">'.get_the_title().'</a></h3>
118
<p>'.smallerexcerptreturn(24).'</p></div></div>';
119
        return $post;
120
        endwhile; wp_reset_query();
121
}
122
 
123
?>                     
124
                       
125
                        <div>
126
                                <?php favrik_recent_posts('group=0&limit=1000'); ?>
127
                               
128
                        </div>
129
                        </div><!-- end content area -->
130
                       
131
 
132
<?php get_footer(); ?>