Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * The template for displaying Taxonomy pages.
- *
- * Learn more: http://codex.wordpress.org/Template_Hierarchy
- *
- * @package WordPress
- * @subpackage Twenty_Twelve
- * @since Twenty Twelve 1.0
- */
- get_header(); ?>
- <section id="primary" class="site-content">
- <div id="content" role="main">
- <header class="tag-header">
- <h1 class="tag-title">
- <?php
- $tax_name = get_query_var( 'taxonomy' );
- $the_tax = get_taxonomy( get_query_var( 'taxonomy' ) );
- echo $the_tax->labels->name; ?>: <?php $args = array( 'taxonomy' => $tax_name );
- $terms = get_terms($tax_name, $args);
- $count = count($terms); $i=0;
- if ($count > 0) {
- $cape_list = '<p class="my_term-archive">';
- foreach ($terms as $term) {
- $i++;
- $term_list .= '<a href="#' . $term->slug . '" title="' . sprintf(__('Jump to %s posts', 'my_localization_domain'), $term->name) . '">' . $term->name . '</a>';
- if ($count != $i) $term_list .= ' · '; else $term_list .= '</p>';
- }
- echo $term_list;
- }; ?>
- </h1>
- </header>
- <?php
- // List posts by the terms for a custom taxonomy of any post type
- $post_type = 'post';
- $tax = get_query_var( 'taxonomy' );
- $tax_terms = get_terms( $tax );
- if ($tax_terms) {
- foreach ($tax_terms as $tax_term) {
- $args = array(
- 'post_type' => $post_type,
- "$tax" => $tax_term->slug,
- 'post_status' => 'publish',
- 'posts_per_page' => -1,
- 'caller_get_posts'=> 1
- );
- $my_query = null;
- $my_query = new WP_Query($args);
- if( $my_query->have_posts() ) : ?>
- <h1 class="tag-subheader" id="<?php echo $tax_term->slug; ?>"><?php echo $tax_term->name; ?> <a class="alignrighthover" href="#top" title=""><img src="http://www.alittlebiteofeverything.com/wp-content/themes/alittlebite/images/arrow.png" border="0" height="20" width="16"></a></h1>
- <div id="gridcontainer">
- <?php
- $counter = 1; //start counter
- $grids = 4; //Grids per row
- global $query_string; //Need this to make pagination work
- /*Setting up our custom query (In here we are setting it to show 12 posts per page and eliminate all sticky posts) */
- query_posts($query_string . '&caller_get_posts=1&posts_per_page=64');
- if(have_posts()) : while( $my_query->have_posts() ) : $my_query->the_post();
- ?>
- <?php
- //Show the left hand side column
- if($counter == 1) :
- ?>
- <div class="griditemleft">
- <div class="postimage">
- <a class="hovereffect" href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail('thumbnail'); ?></a>
- </div>
- <h2><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
- <?php if( $recipetitle = get_post_meta($post->ID, 'recipetitle', true) ): ?> <?php echo apply_filters('the_content', $recipetitle); ?>
- <?php else: $recipetitle = the_title(); ?>
- <?php endif; ?>
- </a></h2>
- </div>
- <?php
- //Show the second column
- elseif($counter == 2) :
- ?>
- <div class="griditemsecond">
- <div class="postimage">
- <a class="hovereffect" href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail('thumbnail'); ?></a>
- </div>
- <h2><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
- <?php if( $recipetitle = get_post_meta($post->ID, 'recipetitle', true) ): ?> <?php echo apply_filters('the_content', $recipetitle); ?>
- <?php else: $recipetitle = the_title(); ?>
- <?php endif; ?>
- </a></h2>
- </div>
- <?php
- //Show the third column
- elseif($counter == 3) :
- ?>
- <div class="griditemthird">
- <div class="postimage">
- <a class="hovereffect" href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail('thumbnail'); ?></a>
- </div>
- <h2><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
- <?php if( $recipetitle = get_post_meta($post->ID, 'recipetitle', true) ): ?> <?php echo apply_filters('the_content', $recipetitle); ?>
- <?php else: $recipetitle = the_title(); ?>
- <?php endif; ?>
- </a></h2>
- </div>
- <?php
- //Show the right hand side column
- elseif($counter == $grids) :
- ?>
- <div class="griditemright">
- <div class="postimage">
- <a class="hovereffect" href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail('thumbnail'); ?></a>
- </div>
- <h2><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
- <?php if( $recipetitle = get_post_meta($post->ID, 'recipetitle', true) ): ?> <?php echo apply_filters('the_content', $recipetitle); ?>
- <?php else: $recipetitle = the_title(); ?>
- <?php endif; ?>
- </a></h2>
- </div>
- <div class="clear"></div>
- <?php
- $counter = 0;
- endif;
- ?>
- <?php
- $counter++;
- endwhile;
- //Pagination can go here if you want it.
- endif;
- ?>
- </div>
- <?php else : ?> <?php endif; // if have_posts()
- wp_reset_query();
- } // end foreach #tax_terms
- }
- ?>
- <p><a href="#top"> Back to top ↑</a></p>
- </div><!-- #content -->
- </section><!-- #primary -->
- <?php get_sidebar(); ?>
- <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement