Revision 653566376333 () - Diff

Link to this snippet: https://friendpaste.com/4Syl57AhzvA1QQ7GG176yF
Embed:
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
<?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(); ?>