Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Template Name: One Category
- *
- * A custom page template Page Name = Category Name .
- *
- * 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(); ?>
- <div id="container">
- <div id="content" role="main">
- <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
- <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
- <div class="entry-content">
- <?php the_content(); ?>
- </div><!-- .entry-content -->
- </div><!-- #post-## -->
- <?php endwhile; ?>
- <?php
- /*
- Run the loop to output the posts.
- Store the page to use later
- */
- global $post;
- $tmp_post = $post;
- //Create a query for the category
- $pageslug = $post->post_name;
- $catslug = get_category_by_slug($pageslug);
- $catid = $catslug->term_id;
- $query= 'cat=' . $catid. '&order=ASC'; query_posts($query);
- //Get the lines
- get_template_part( 'loop', 'category' );
- //Reset our page to get the sidebar
- $post = $tmp_post;
- ?>
- </div><!-- #content -->
- </div><!-- #container -->
- <?php get_sidebar(); ?>
- <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment