SHOW:
|
|
- or go back to the newest paste.
| 1 | <?php | |
| 2 | /* | |
| 3 | Template Name: Multi Query Page | |
| 4 | */ | |
| 5 | ?> | |
| 6 | ||
| 7 | <?php | |
| 8 | get_header(); ?> | |
| 9 | ||
| 10 | <div id="container"> | |
| 11 | <div id="content" role="main"> | |
| 12 | ||
| 13 | ||
| 14 | <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?> | |
| 15 | ||
| 16 | <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> | |
| 17 | <?php if ( is_front_page() ) { ?>
| |
| 18 | <h2 class="entry-title"><?php the_title(); ?></h2> | |
| 19 | <?php } else { ?>
| |
| 20 | <h1 class="entry-title"><?php the_title(); ?></h1> | |
| 21 | <?php } ?> | |
| 22 | ||
| 23 | <div class="entry-content"> | |
| 24 | <?php the_content(); ?> | |
| 25 | <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?> | |
| 26 | <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="edit-link">', '</span>' ); ?> | |
| 27 | ||
| 28 | <?/*php comments_template( '', true ); */?> | |
| 29 | ||
| 30 | </div><!-- .entry-content --> | |
| 31 | </div><!-- #post-## --> | |
| 32 | ||
| 33 | ||
| 34 | <?php endwhile; // end of the loop. ?> | |
| 35 | ||
| 36 | ||
| 37 | <div> | |
| 38 | ||
| 39 | <h3><a name="category3">Category 3</a></h3> | |
| 40 | ||
| 41 | <?php | |
| 42 | // Show a selected number of posts per row | |
| 43 | $posts_per_row = 2; | |
| 44 | $posts_per_page = 4; | |
| 45 | $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
| |
| 46 | $args = array( | |
| 47 | 'posts_per_page' => $posts_per_page, | |
| 48 | 'paged' => $paged,); | |
| 49 | ||
| 50 | query_posts( array( 'posts_per_page' => 4, 'cat' => '3', 'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1 ), ));
| |
| 51 | ||
| 52 | if (have_posts()) {
| |
| 53 | while (have_posts()) {
| |
| 54 | the_post(); | |
| 55 | ||
| 56 | if ((++$post_counter % $posts_per_row) == 1 || $posts_per_row == 1) {
| |
| 57 | if ($post_counter > 1) {
| |
| 58 | echo "</div><!-- End of post_row -->\n"; // End previous row | |
| 59 | } | |
| 60 | echo "<div class='post_row'>\n"; // Start a new row | |
| 61 | } | |
| 62 | echo "<div class='post_class'>\n"; // Start one post | |
| 63 | ||
| 64 | ||
| 65 | // Output post data here | |
| 66 | ||
| 67 | echo '<h2>';the_title() ;echo '</h2>'; | |
| 68 | ||
| 69 | echo the_post_thumbnail('thumbnail');
| |
| 70 | ||
| 71 | the_excerpt(); | |
| 72 | ?> | |
| 73 | ||
| 74 | <?php | |
| 75 | echo "</div><!-- End of post_class -->\n"; // End of post | |
| 76 | } ?> | |
| 77 | </div><!-- End of post_row --> | |
| 78 | <div class='clear'></div> | |
| 79 | ||
| 80 | ||
| 81 | <?php } else {
| |
| 82 | // Code for no posts found | |
| 83 | } | |
| 84 | ?> | |
| 85 | ||
| 86 | <h3><a name="category4">Category 4</a></h3> | |
| 87 | ||
| 88 | <?php | |
| 89 | // Show a selected number of posts per row | |
| 90 | $posts_per_row = 2; | |
| 91 | $posts_per_page = 4; | |
| 92 | $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
| |
| 93 | $args = array( | |
| 94 | 'posts_per_page' => $posts_per_page, | |
| 95 | 'paged' => $paged,); | |
| 96 | ||
| 97 | query_posts( array( 'posts_per_page' => 4, 'cat' => '4', 'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1 ), ));
| |
| 98 | ||
| 99 | ||
| 100 | if (have_posts()) {
| |
| 101 | while (have_posts()) {
| |
| 102 | the_post(); | |
| 103 | if ((++$post_counter % $posts_per_row) == 1 || $posts_per_row == 1) {
| |
| 104 | if ($post_counter > 1) {
| |
| 105 | echo "</div><!-- End of post_row -->\n"; // End previous row | |
| 106 | } | |
| 107 | echo "<div class='post_row'>\n"; // Start a new row | |
| 108 | } | |
| 109 | echo "<div class='post_class'>\n"; // Start one post | |
| 110 | ||
| 111 | // Output post data here | |
| 112 | ||
| 113 | - | the_excerpt(); |
| 113 | + | |
| 114 | ||
| 115 | echo the_post_thumbnail('thumbnail');
| |
| 116 | ||
| 117 | the_excerpt();?> | |
| 118 | ||
| 119 | <?php | |
| 120 | ||
| 121 | echo "</div><!-- End of post_class -->\n"; // End of post | |
| 122 | - | <div class='clear'></div> |
| 122 | + | |
| 123 | ||
| 124 | </div><!-- End of post_row --> | |
| 125 | ||
| 126 | ||
| 127 | <div class='clear'></div> | |
| 128 | ||
| 129 | ||
| 130 | <?php } else {
| |
| 131 | // Code for no posts found | |
| 132 | } | |
| 133 | ?> | |
| 134 | ||
| 135 | </div> | |
| 136 | ||
| 137 | ||
| 138 | </div><!-- #container --> | |
| 139 | ||
| 140 | ||
| 141 | <?php get_sidebar(); ?> | |
| 142 | ||
| 143 | <?php get_footer(); ?> |