Advertisement
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_Eleven
- * @since Twenty Eleven 1.0
- */
- get_header(); ?>
- <div id="primary">
- <div id="content" role="main">
- <?php the_post(); global $post; $tmp_post = $post; ?>
- <?php get_template_part( 'content', 'page' ); ?>
- <?php
- /*
- Run the loop to output the posts.
- Store the page to use later
- */
- //Create a query for the category
- global $cat_detail;
- $pageslug = $post->post_name;
- $catslug = get_category_by_slug($pageslug);
- $catid = $catslug->term_id;
- $detail = $cat_detail[$catid];
- $asc = ($detail['asc']);
- $query= 'cat=' . $catid. '&order=' .$asc; query_posts($query);
- //Get the lines
- ?>
- <?php if ( have_posts() ) : ?>
- <?php twentyeleven_content_nav( 'nav-above' ); ?>
- <?php while ( have_posts() ) : the_post(); ?>
- <?php get_template_part( 'content', 'onecat' ); ?>
- <?php endwhile; ?>
- <?php twentyeleven_content_nav( 'nav-below' ); ?>
- <?php endif;
- //Reset our page to get the sidebar
- $post = $tmp_post;
- ?>
- <?php comments_template( '', true ); ?>
- </div><!-- #content -->
- </div><!-- #primary -->
- <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement