Advertisement
alchymyth

patched cat file

Apr 16th, 2016
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.52 KB | None | 0 0
  1. <?php
  2. /**
  3.  * The template for displaying Category pages
  4.  *
  5.  * Used to display archive-type pages for posts in a category.
  6.  * //patched for 'no-found' results//
  7.  * @link http://codex.wordpress.org/Template_Hierarchy
  8.  *
  9.  * @by JoomSpirit
  10.  * 1.0
  11.  */
  12.  
  13. get_header();
  14. get_template_part('after-header'); ?>
  15.  
  16.  
  17.         <?php if ( have_posts() ) : ?>
  18.             <header class="archive-header">
  19.                 <h1 class="archive-title"><?php echo '<span>' . single_cat_title( '', false ) . '</span>' ; ?></h1>
  20.  
  21.             <?php if ( category_description() ) : // Show an optional category description ?>
  22.                 <div class="archive-meta"><?php echo category_description(); ?></div>
  23.             <?php endif; ?>
  24.             </header><!-- .archive-header -->
  25.            
  26.             <div class="clear"></div>
  27.            
  28.             <?php
  29.             /* Start the Loop */
  30.            
  31.             $i = 0;     // variable to positionning articles in several columns
  32.            
  33.             $columns_posts = get_theme_mod('columns_posts', '1');
  34.             if ( ( ! is_singular() ) && ( is_category( get_theme_mod('three_columns', 'none') )) ) { $columns_posts = '3'; }
  35.             if ( ( ! is_singular() ) && ( is_category( get_theme_mod('two_columns', 'none') )) ) { $columns_posts = '2'; }
  36.             if ( ( ! is_singular() ) && ( is_category( get_theme_mod('single_column', 'none') )) ) { $columns_posts = '1'; }
  37.        
  38.             while ( have_posts() ) : the_post();
  39.            
  40.                 $i += 1;
  41.  
  42.                 /* Include the post format-specific template for the content. If you want to
  43.                  * this in a child theme then include a file called called content-___.php
  44.                  * (where ___ is the post format) and that will be used instead.
  45.                  */
  46.                 get_template_part( 'content', get_post_format() );
  47.                
  48.                 if ( $columns_posts != '' ) { $number_columns = $columns_posts; } else { $number_columns = 1 ;}
  49.                 if ($i % $number_columns == 0) echo '<div class="clear"></div>'; //     add a "clear : both" DIV under each even article
  50.                
  51.             endwhile;
  52.  
  53.             joomspirit_content_nav( 'nav-below' );
  54.             ?>
  55.  
  56.         <?php else : ?>
  57.             <header class="archive-header">
  58.                 <h1 class="archive-title"><?php echo '<span>' . single_cat_title( '', false ) . '</span>' ; ?></h1>
  59.  
  60.             <?php if ( category_description() ) : // Show an optional category description ?>
  61.                 <div class="archive-meta"><?php echo category_description(); ?></div>
  62.             <?php endif; ?>
  63.             </header><!-- .archive-header -->
  64.            
  65.             <div class="clear"></div>
  66.             <article <?php post_class('no-posts'); ?> >
  67.             <?php echo 'No posts found in this category.'; ?>
  68.             </article><!-- /.no-posts-->
  69.         <?php endif; ?>
  70.  
  71.  
  72. <?php
  73. get_template_part('before-footer');
  74. get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement