Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Template Name: Page of Posts
- *
- * A custom page template for article section.
- *
- * The "Template Name:" bit above allows this to be selectable
- * from a dropdown menu on the edit page screen.
- *
- * @package WordPress
- * @subpackage Twenty_Ten
- * @since Twenty Ten 1.0
- */
- get_header(posts); ?>
- <div id="container">
- <div id="content" role="main">
- <?php
- if (is_page() ) {
- $category = get_post_meta($posts[0]->ID, 'category', true);
- }
- if ($category) {
- $cat = get_cat_ID($category);
- $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
- $post_per_page = 0; // -1 shows all posts
- $do_not_show_stickies = 1; // 0 to show stickies
- $args=array(
- 'category__in' => array($cat),
- 'showposts' => $showposts,
- 'caller_get_posts' => $do_not_show_stickies
- );
- $my_query = new WP_Query($args);
- ?>
- <?php if( $my_query->have_posts() ) : ?>
- <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
- <?php $count++; ?>
- <!-- This is where you tell how many posts to show excerpts -->
- <?php if ($count <= 3) : ?>
- <h2 class="entry-title"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
- <div class="entry-meta">
- <span class="meta-prep meta-prep-author">Posted on</span>
- <span class="entry-date">
- <?php the_time('F jS, Y') ?>
- </span>
- <span class="meta-sep">by</span>
- <span class="author vcard"><?php the_author_posts_link() ?></span>
- </div>
- <div class="entry-content">
- <?php
- global $more; // Declare global $more (before the loop).
- $more = 0; // Set (inside the loop) to display content above the more tag.
- the_content("Continue Reading...");
- ?>
- </div>
- <?php else : ?>
- <h2 class="entry-title" style="margin-top: 10px; font-size: 16px;"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
- <?php
- //necessary to show the tags
- global $wp_query;
- $wp_query->in_the_loop = true;
- ?>
- <?php endif; ?>
- <?php endwhile; ?>
- <?php else : ?>
- <h3 class="center">Not Found</h3>
- <p class="center">Sorry, but you are looking for something that isn't here.</p>
- <?php get_search_form(); ?>
- <?php endif;
- } // if ($category)
- ?>
- </div><!-- #content -->
- </div><!-- #container -->
- <?php get_sidebar('posts'); ?>
- <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement