SHOW:
|
|
- or go back to the newest paste.
| 1 | <?php | |
| 2 | /** | |
| 3 | *Template Name: PageOfPosts | |
| 4 | */ | |
| 5 | ?> | |
| 6 | <?get_header(); ?> | |
| 7 | ||
| 8 | <div id="container"> | |
| 9 | <div id="content" role="main"> | |
| 10 | ||
| 11 | <?php | |
| 12 | if ( is_page('15') ) {
| |
| 13 | $cat = array(3); | |
| 14 | } elseif ( is_page('20') ) {
| |
| 15 | $cat = array(4); | |
| 16 | } elseif ( is_page('32') ) {
| |
| 17 | $cat = array(5, 7); | |
| 18 | } else {
| |
| 19 | $cat = ''; | |
| 20 | } $args = array( | |
| 21 | 'category__in' => $cat, | |
| 22 | 'caller_get_posts' => 1 | |
| 23 | ); | |
| 24 | if ( $paged > 1 ) {
| |
| 25 | $args['paged'] = $paged; | |
| 26 | } | |
| 27 | - | $my_query = new WP_Query($args); ?> |
| 27 | + | $wp_query = new WP_Query($args); ?> |
| 28 | <?php if (have_posts()) : while (have_posts()) : the_post(); ?> | |
| 29 | <div class="post" id="post-<?php the_ID(); ?>"> | |
| 30 | <h2><?php the_title(); ?></h2> | |
| 31 | <div class="entry"> | |
| 32 | <?php the_content('<p class="serif">Read the rest of this page ยป</p>'); ?>
| |
| 33 | ||
| 34 | <?php wp_link_pages(array('before' => '<p>Pages: ', 'after'
| |
| 35 | => '</p>', 'next_or_number' => 'number')); ?> | |
| 36 | ||
| 37 | </div> | |
| 38 | </div> | |
| 39 | <?php endwhile; endif; ?> | |
| 40 | <?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
| |
| 41 | - | <?php if ( $my_query->have_posts() ) : ?> |
| 41 | + | <?php if ( $wp_query->have_posts() ) : ?> |
| 42 | - | <?php while ( $my_query->have_posts() ) : |
| 42 | + | <?php while ( $wp_query->have_posts() ) : |
| 43 | - | $my_query->the_post(); ?> |
| 43 | + | $wp_query->the_post(); ?> |
| 44 | <?php | |
| 45 | //necessary to show the tags | |
| 46 | global $wp_query; | |
| 47 | $wp_query->in_the_loop = true; | |
| 48 | ?> | |
| 49 | <div <?php post_class() ?> id="post-<?php the_ID(); ?>"> | |
| 50 | <h2>" rel="bookmark" title="Permanent Link | |
| 51 | to <?php the_title_attribute(); ?>"><? php the_title(); ?></h2> | |
| 52 | <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --
| |
| 53 | ></small> | |
| 54 | ||
| 55 | <div class="entry"> | |
| 56 | <?php the_excerpt('Read the rest of this entry ยป'); ?>
| |
| 57 | </div> | |
| 58 | </div> | |
| 59 | <?php endwhile; ?> | |
| 60 | ||
| 61 | <div class="navigation"> | |
| 62 | <div class="alignleft"><?php | |
| 63 | if ( !is_single() && $paged > 1 ) {
| |
| 64 | $attr = apply_filters( 'previous_posts_link_attributes', '' ); | |
| 65 | echo '". preg_replace( '/&([^#]) | |
| 66 | (?![a-z]{1,8};)/', '&$1', 'ยซ Previous Page' ) .' ';
| |
| 67 | } ?></div> | |
| 68 | ||
| 69 | <div class="alignright"><?php | |
| 70 | if ( !$max_page ) {
| |
| 71 | - | $max_page = $my_query->max_num_pages; } |
| 71 | + | $max_page = $wp_query->max_num_pages; } |
| 72 | ||
| 73 | if ( !$paged ) {
| |
| 74 | $paged = 1; | |
| 75 | } | |
| 76 | $nextpage = intval($paged) + 1; | |
| 77 | ||
| 78 | if ( !is_single() && ( empty($paged) || $nextpage <= $max_page) ) {
| |
| 79 | $attr = apply_filters( 'next_posts_link_attributes', '' ); | |
| 80 | echo '". preg_replace('/&([^#])
| |
| 81 | (?![a-z]{1,8};)/', '&$1', 'Next Page ยป') .' ';
| |
| 82 | } | |
| 83 | ?></div> | |
| 84 | <?php else : ?> | |
| 85 | <h2 class="center">Not Found</h2> | |
| 86 | <p class="center">Sorry, but you are looking for something that isn't here.</p> | |
| 87 | <?php get_search_form(); ?> | |
| 88 | <?php endif; ?> | |
| 89 | </div> | |
| 90 | </div><!-- #content --> | |
| 91 | </div><!-- #container --> | |
| 92 | <?php get_sidebar(); ?> | |
| 93 | <?php get_footer(); ?> |