4Syl57AhzvA1QQ7GG176yF changeset

Changeset653566376333 (b)
ParentNone (a)
ab
0+<?php get_header(); ?>
0+ 
0+<div id="main" class="clearfix">
0+        <div id="posts" class="grid_8">
0+ 
0+<?php
0+// Global $wp_query so it's available to check for args
0+global $wp_query;
0+ 
0+$per_page = 10;
0+ 
0+// Add paging
0+$paged = ( get_query_var('paged') && get_query_var('paged') > 1 ) ? get_query_var('paged') : 1;
0+ 
0+// Your args
0+$custom_args = array(
0+        'posts_per_page' => $per_page,
0+        'paged' => $paged,
0+                'post__not_in' => get_option('sticky_posts'),
0+                'caller_get_posts'=>1,
0+);
0+// Get the current query vars, if they exist
0+$args = array_filter( $wp_query->query_vars ); // The array filter removes 0, false, null values, etc
0+// If there were args, ie. a non empty array, merge them with the custom ones, else just use the custom ones
0+$args = ( $args && ( is_array( $args ) && !empty( $args ) ) ) ? array_merge( $custom_args , $args ) : $custom_args;
0+ 
0+// Put the args into the query
0+query_posts( $args );
0+ 
0+// If the query has results, ie. posts
0+if( have_posts() ) :
0+        $counter = 0;
0+       
0+        // While the query has posts
0+        while( have_posts() ) : the_post();
0+                // Increase counter by one, so first is 1, second is 2, etc...
0+                $counter++;
0+               
0+                // If the counter is less then 6, it's one of the first 5 posts
0+                if( $counter < 6 ) :
0+?>
0+                                        <div class="post">
0+                                <h1 class="post-title"><a href="<?php the_permalink(); ?>" title="Continue reading &quot;<?php the_title(); ?>&quot;"><?php the_title(); ?></a></h1>
0+                                <div class="post-meta clearfix">
0+                                        <span>Posted: <abbr title="Posted at <?php the_time('H:i') ?> on <?php the_time('l, F j, Y'); ?>"><?php if(!function_exists('how_long_ago')){the_time('l, F j, Y'); } else { echo how_long_ago(get_the_time('U')); } ?></abbr></span>
0+                                        <span>Category: <?php the_category(', ') ?></span>
0+                                        <span>Comments: <?php comments_number('No Comment','1 Comment','% Comments'); ?></span>
0+                                </div>
0+                                <div class="post-image">
0+                                                        <?php if( get_post_meta( $post->ID, "image", true ) ) : ?>
0+                                                        <img src="<?php bloginfo( 'template_directory' ); ?>/timthumb.php?src=<?php echo get_post_meta( $post->ID, "image", true ); ?>&amp;w=576&amp;zc=1&amp;q=90" border="0" alt="<?php the_title(); ?>" />
0+                                                <?php else : ?>
0+                                        <?php endif; ?>
0+                                </div>
0+                                <div class="post-excerpt"><?php the_content('<span class="post-link">Continue reading &raquo;</span>'); ?></div>
0+                        </div>
0+<?php
0+                // Else the counter is more then 5, so it's one of the 15 following posts
0+                else :
0+?>
0+               
0+                        <div class="post-small">
0+                       
0+                        <?php the_date('', '<br />', '<hr />'); ?>
0+
0+                                <h1 class="post-title-small"><a href="<?php the_permalink(); ?>" title="Continue reading &quot;<?php the_title(); ?>&quot;"><?php the_title(); ?></a></h1>
0+                                <div class="post-meta clearfix">
0+                                        <span>Posted: <abbr title="Posted at <?php the_time('H:i') ?> on <?php the_time('l, F j, Y'); ?>"><?php if(!function_exists('how_long_ago')){the_time('l, F j, Y'); } else { echo how_long_ago(get_the_time('U')); } ?></abbr></span>
0+                                        <span>Category: <?php the_category(', ') ?></span>
0+                                        <span>Comments: <?php comments_number('No Comment','1 Comment','% Comments'); ?></span>
0+                                </div>
0+
0+                </div>
0+                       
0+<?php
0+                // End if counter check
0+                endif;
0+        // End post loop
0+        endwhile;
0+// End if have posts check
0+endif;
0+?>
0+                <div class="post-navigation clearfix"><?php if(function_exists('wp_pagenavi')) wp_pagenavi(); ?></div>
0+        </div>
0+        <div id="sidebar" class="grid_4">
0+                <?php get_sidebar(); ?>
0+        </div>
0+</div>
0+<?php get_footer(); ?>
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
--- Revision None
+++ Revision 653566376333
@@ -0,0 +1,89 @@
+<?php get_header(); ?>
+
+<div id="main" class="clearfix">
+ <div id="posts" class="grid_8">
+
+<?php
+// Global $wp_query so it's available to check for args
+global $wp_query;
+
+$per_page = 10;
+
+// Add paging
+$paged = ( get_query_var('paged') && get_query_var('paged') > 1 ) ? get_query_var('paged') : 1;
+
+// Your args
+$custom_args = array(
+ 'posts_per_page' => $per_page,
+ 'paged' => $paged,
+ 'post__not_in' => get_option('sticky_posts'),
+ 'caller_get_posts'=>1,
+);
+// Get the current query vars, if they exist
+$args = array_filter( $wp_query->query_vars ); // The array filter removes 0, false, null values, etc
+// If there were args, ie. a non empty array, merge them with the custom ones, else just use the custom ones
+$args = ( $args && ( is_array( $args ) && !empty( $args ) ) ) ? array_merge( $custom_args , $args ) : $custom_args;
+
+// Put the args into the query
+query_posts( $args );
+
+// If the query has results, ie. posts
+if( have_posts() ) :
+ $counter = 0;
+
+ // While the query has posts
+ while( have_posts() ) : the_post();
+ // Increase counter by one, so first is 1, second is 2, etc...
+ $counter++;
+
+ // If the counter is less then 6, it's one of the first 5 posts
+ if( $counter < 6 ) :
+?>
+ <div class="post">
+ <h1 class="post-title"><a href="<?php the_permalink(); ?>" title="Continue reading &quot;<?php the_title(); ?>&quot;"><?php the_title(); ?></a></h1>
+ <div class="post-meta clearfix">
+ <span>Posted: <abbr title="Posted at <?php the_time('H:i') ?> on <?php the_time('l, F j, Y'); ?>"><?php if(!function_exists('how_long_ago')){the_time('l, F j, Y'); } else { echo how_long_ago(get_the_time('U')); } ?></abbr></span>
+ <span>Category: <?php the_category(', ') ?></span>
+ <span>Comments: <?php comments_number('No Comment','1 Comment','% Comments'); ?></span>
+ </div>
+ <div class="post-image">
+ <?php if( get_post_meta( $post->ID, "image", true ) ) : ?>
+ <img src="<?php bloginfo( 'template_directory' ); ?>/timthumb.php?src=<?php echo get_post_meta( $post->ID, "image", true ); ?>&amp;w=576&amp;zc=1&amp;q=90" border="0" alt="<?php the_title(); ?>" />
+ <?php else : ?>
+ <?php endif; ?>
+ </div>
+ <div class="post-excerpt"><?php the_content('<span class="post-link">Continue reading &raquo;</span>'); ?></div>
+ </div>
+<?php
+ // Else the counter is more then 5, so it's one of the 15 following posts
+ else :
+?>
+
+ <div class="post-small">
+
+ <?php the_date('', '<br />', '<hr />'); ?>
+
+ <h1 class="post-title-small"><a href="<?php the_permalink(); ?>" title="Continue reading &quot;<?php the_title(); ?>&quot;"><?php the_title(); ?></a></h1>
+ <div class="post-meta clearfix">
+ <span>Posted: <abbr title="Posted at <?php the_time('H:i') ?> on <?php the_time('l, F j, Y'); ?>"><?php if(!function_exists('how_long_ago')){the_time('l, F j, Y'); } else { echo how_long_ago(get_the_time('U')); } ?></abbr></span>
+ <span>Category: <?php the_category(', ') ?></span>
+ <span>Comments: <?php comments_number('No Comment','1 Comment','% Comments'); ?></span>
+ </div>
+
+ </div>
+
+<?php
+ // End if counter check
+ endif;
+ // End post loop
+ endwhile;
+// End if have posts check
+endif;
+?>
+ <div class="post-navigation clearfix"><?php if(function_exists('wp_pagenavi')) wp_pagenavi(); ?></div>
+ </div>
+ <div id="sidebar" class="grid_4">
+ <?php get_sidebar(); ?>
+ </div>
+</div>
+<?php get_footer(); ?>