View difference between Paste ID: t1U1dkUv and sc8qpx6g
SHOW: | | - or go back to the newest paste.
1
<?php
2
/**
3
 * The loop to show posts in columns
4
 *
5
 * loop-grid.php
6
 
7
 * @package WordPress
8
 * @subpackage Twenty Ten
9
 * @since 3.0.0
10
 */
11
?>
12
13
<?php
14
$num_cols = 3; // set the number of columns here 
15
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1; // for pagination
16
$grid_args = array(
17
  'posts_per_page' => 6, // optional to overwrite the dashboard setting
18
  'cat' => 0, // add any other query parameter to this array
19
  'paged' => $paged,
20
);
21
global $wp_query;
22
$args = array_merge( $wp_query->query, $grid_args );
23
query_posts( $args );
24
?>
25
26
<?php /* Display navigation to next/previous pages when applicable */ ?>
27
<?php if (  $wp_query->max_num_pages > 1 ) : ?>
28
				<div id="nav-above" class="navigation">
29
				<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } else { ?>
30
					<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'twentyten' ) ); ?></div>
31
					<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'twentyten' ) ); ?></div>
32
					<?php } ?>
33
				</div><!-- #nav-above -->
34
<?php endif; ?>
35
<?php /* If there are no posts to display, such as an empty archive page */ ?>
36
<?php if ( ! have_posts() ) : ?>
37
	<div id="post-0" class="post error404 not-found">
38
		<h1 class="entry-title"><?php _e( 'Not Found', 'twentyten' ); ?></h1>
39
		<div class="entry-content">
40-
$args = array(
40+
41
			<?php get_search_form(); ?>
42
		</div><!-- .entry-content -->
43
	</div><!-- #post-0 -->
44
<?php endif; ?>
45
<?php if ( function_exists( 'meteor_slideshow' ) ) { meteor_slideshow(); } ?>
46
47
<?php /* Start the Loop */ ?>
48
49
50
<?php 
51
52
for ( $i=1 ; $i <= $num_cols; $i++ ) :
53
echo '<div id="col-' . $i . '" class="col" >';
54
$counter = $num_cols + 1 - $i; ?>
55
56
<?php while (have_posts()) : the_post();
57
if( $counter%$num_cols == 0 ) : 
58
// begin of core posts output ?>
59
60
61
		<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
62
			<div class="post-thumb">
63
			
64
			<?php echo get_the_post_thumbnail( $post_id, $size, $attr ); ?> <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
65
			</div>
66
			
67
			<div class="entry-meta">
68
				<?php
69
					printf( __( '<span class="meta-prep meta-prep-author">Posted on </span><a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a> <span class="meta-sep"> by </span> <span class="author vcard"><a class="url fn n" href="%4$s" title="%5$s">%6$s</a></span>', 'twentyten' ),
70
						get_permalink(),
71
						esc_attr( get_the_time() ),
72
						get_the_date(),
73
						get_author_posts_url( get_the_author_meta( 'ID' ) ),
74
						sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ),
75
						get_the_author()
76
					);
77
				?><span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
78
			</div><!-- .entry-meta -->
79
80
			<div class="entry-summary">
81
				<?php the_excerpt(); ?>
82
			</div><!-- .entry-summary -->
83
			
84
			<div class="entry-utility">
85
				<span class="cat-links"><span class="entry-utility-prep entry-utility-prep-cat-links"><?php _e( 'Posted in ', 'twentyten' ); ?></span><?php the_category( ', ' ); ?></span>
86
				<span class="meta-sep"> | </span>
87
				<?php the_tags( '<span class="tag-links"><span class="entry-utility-prep entry-utility-prep-tag-links">' . __( 'Tagged ', 'twentyten' ) . '</span>', ', ', '<span class="meta-sep"> | </span>' ); ?>
88
				<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
89
				<?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
90
			</div><!-- #entry-utility -->
91
		</div><!-- #post-<?php the_ID(); ?> -->
92
		<?php // global $withcomments; $withcomments = 1; 
93
		//comments_template( '', true ); ?>
94
95
<?php //end of posts output
96
97
endif; $counter++;
98
endwhile;
99
rewind_posts();
100
echo '</div>'; //closes the column div
101
endfor; ?>
102
103
<?php /* Display navigation to next/previous pages when applicable */ ?>
104
<?php if (  $wp_query->max_num_pages > 1 ) : ?>
105
				<div id="nav-below" class="navigation">
106
				<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } else { ?>
107
					<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'twentyten' ) ); ?></div>
108
					<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'twentyten' ) ); ?></div>
109
					<?php } ?>
110
				</div><!-- #nav-below -->
111
<?php endif; 
112
 wp_reset_query(); ?>