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 /* Display navigation to next/previous pages when applicable */ ?> | |
14 | <?php if ( $wp_query->max_num_pages > 1 ) : ?> | |
15 | <div id="nav-above" class="navigation"> | |
16 | <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } else { ?> | |
17 | <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'twentyten' ) ); ?></div> | |
18 | <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'twentyten' ) ); ?></div> | |
19 | <?php } ?> | |
20 | </div><!-- #nav-above --> | |
21 | <?php endif; ?> | |
22 | <?php /* If there are no posts to display, such as an empty archive page */ ?> | |
23 | <?php if ( ! have_posts() ) : ?> | |
24 | <div id="post-0" class="post error404 not-found"> | |
25 | <h1 class="entry-title"><?php _e( 'Not Found', 'twentyten' ); ?></h1> | |
26 | <div class="entry-content"> | |
27 | <p><?php _e( 'Apologies, but no results were found for the requested Archive. Perhaps searching will help find a related post.', 'twentyten' ); ?></p> | |
28 | <?php get_search_form(); ?> | |
29 | </div><!-- .entry-content --> | |
30 | </div><!-- #post-0 --> | |
31 | <?php endif; ?> | |
32 | <?php if ( function_exists( 'meteor_slideshow' ) ) { meteor_slideshow(); } ?> | |
33 | ||
34 | <?php /* Start the Loop */ ?> | |
35 | ||
36 | ||
37 | <?php | |
38 | $num_cols = 3; // set the number of columns here | |
39 | $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; // for pagination | |
40 | $args = array( | |
41 | 'posts_per_page' => 6, // optional to overwrite the dashboard setting | |
42 | 'cat' => 0, // add any other query parameter to this array | |
43 | 'paged' => $paged, | |
44 | ); | |
45 | ||
46 | for ( $i=1 ; $i <= $num_cols; $i++ ) : | |
47 | echo '<div id="col-' . $i . '" class="col" >'; | |
48 | $counter = $num_cols + 1 - $i; ?> | |
49 | ||
50 | <?php while (have_posts()) : the_post(); | |
51 | if( $counter%$num_cols == 0 ) : | |
52 | // begin of core posts output ?> | |
53 | ||
54 | ||
55 | <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> | |
56 | <div class="post-thumb"> | |
57 | ||
58 | <?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> | |
59 | </div> | |
60 | ||
61 | <div class="entry-meta"> | |
62 | <?php | |
63 | 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' ), | |
64 | get_permalink(), | |
65 | esc_attr( get_the_time() ), | |
66 | get_the_date(), | |
67 | get_author_posts_url( get_the_author_meta( 'ID' ) ), | |
68 | sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ), | |
69 | get_the_author() | |
70 | ); | |
71 | ?><span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span> | |
72 | </div><!-- .entry-meta --> | |
73 | ||
74 | <div class="entry-summary"> | |
75 | <?php the_excerpt(); ?> | |
76 | </div><!-- .entry-summary --> | |
77 | ||
78 | <div class="entry-utility"> | |
79 | <span class="cat-links"><span class="entry-utility-prep entry-utility-prep-cat-links"><?php _e( 'Posted in ', 'twentyten' ); ?></span><?php the_category( ', ' ); ?></span> | |
80 | <span class="meta-sep"> | </span> | |
81 | <?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>' ); ?> | |
82 | <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span> | |
83 | <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?> | |
84 | </div><!-- #entry-utility --> | |
85 | </div><!-- #post-<?php the_ID(); ?> --> | |
86 | <?php // global $withcomments; $withcomments = 1; | |
87 | //comments_template( '', true ); ?> | |
88 | ||
89 | <?php //end of posts output | |
90 | ||
91 | endif; $counter++; | |
92 | endwhile; | |
93 | rewind_posts(); | |
94 | echo '</div>'; //closes the column div | |
95 | endfor; ?> | |
96 | ||
97 | <?php /* Display navigation to next/previous pages when applicable */ ?> | |
98 | <?php if ( $wp_query->max_num_pages > 1 ) : ?> | |
99 | <div id="nav-below" class="navigation"> | |
100 | <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } else { ?> | |
101 | - | <?php if(function_exists('page_navi')) { page_navi(); } else { ?> |
101 | + | |
102 | - | <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'twentyten' ) ); ?></div> |
102 | + | |
103 | - | <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'twentyten' ) ); ?></div> |
103 | + | |
104 | </div><!-- #nav-below --> | |
105 | <?php endif; | |
106 | wp_reset_query(); ?> |