Advertisement
Guest User

Untitled

a guest
Jan 3rd, 2015
329
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.26 KB | None | 0 0
  1. <?php
  2. /**
  3.  * @package WordPress
  4.  * @subpackage Default_Theme
  5.  */
  6.  
  7. get_header();
  8. ?>
  9.  
  10. <?php $queried_category = get_term( get_query_var('cat'), 'category' ); ?>
  11. <?php $categoryValue = get_field('feature_in_category'); ?>
  12.  
  13.  
  14. <section class="section-header-title category-<?php echo $queried_category->slug; ?> ">
  15.     <div class="row">
  16.         <div class="small-12 columns">
  17.             <?php if (have_posts()) : ?>
  18.  
  19.               <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
  20.               <?php /* If this is a category archive */ if (is_category()) { ?>
  21.                 <h2 class="pagetitle"><?php printf(__('%s', 'kubrick'), single_cat_title('', false)); ?></h2>
  22.               <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
  23.                 <h2 class="pagetitle"><?php printf(__('Posts Tagged &#8216;%s&#8217;', 'kubrick'), single_tag_title('', false) ); ?></h2>
  24.               <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
  25.                 <h2 class="pagetitle"><?php printf(_c('%s', 'kubrick'), get_the_time(__('F jS, Y', 'kubrick'))); ?></h2>
  26.               <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
  27.                 <h2 class="pagetitle"><?php printf(_c('%s', 'kubrick'), get_the_time(__('F, Y', 'kubrick'))); ?></h2>
  28.               <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
  29.                 <h2 class="pagetitle"><?php printf(_c('%s', 'kubrick'), get_the_time(__('Y', 'kubrick'))); ?></h2>
  30.               <?php /* If this is an author archive */ } elseif (is_author()) { ?>
  31.                 <h2 class="pagetitle"><?php _e('Author Archive', 'kubrick'); ?></h2>
  32.               <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
  33.                 <h2 class="pagetitle"><?php _e('Blog Archives', 'kubrick'); ?></h2>
  34.               <?php } ?>
  35.              
  36.                 <span class="header-breadcrumb">
  37.                     <?php the_breadcrumb(); ?>
  38.                 </span>
  39.         </div>
  40.     </div>
  41. </section>
  42.  
  43. <section class="main-content">
  44.    
  45.     <div class="row collapse">
  46.     <div class="small-12 large-9 columns">
  47.         <div class="row collapse">
  48.             <div class="small-12 large-12 columns">
  49.            
  50.                 <?php
  51.  
  52.                     // args
  53.                     $args = array(
  54.                         //'numberposts' => -1,
  55.                         'cat' => $categoryValue,
  56.                         'orderby'=> 'modified',
  57.                         'posts_per_page' => 1
  58.                     );
  59.  
  60.                     // get results
  61.                     $the_query = new WP_Query( $args );
  62.                    
  63.                     // The Loop
  64.                     ?>
  65.                     <?php if( $the_query->have_posts() ): ?>
  66.                
  67.                        
  68.                     <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
  69.                         <div class="small-6 columns">
  70.                             <div class="img-box-shadow">
  71.                                 <a href="<?php the_permalink(); ?>">
  72.                                     <?php echo the_post_thumbnail(); ?>
  73.                                 </a>
  74.                             </div>
  75.                         </div>
  76.                         <div class="small-6 columns">
  77.                             <h3><a href="<?php the_permalink(); ?>"><?php echo the_title(); ?></a></h3>
  78.                             <p><?php echo the_excerpt(); ?></p>
  79.                         </div>
  80.  
  81.                                
  82.                     <?php endwhile; ?>
  83.                    
  84.                     <?php else : echo '<p style="color:#fff;">no posts</p>'; ?>
  85.                    
  86.                     <?php endif; ?>
  87.                     <?php wp_reset_query();  // Restore global post data stomped by the_post(). ?>
  88.                     <div class="clearboth"></div>
  89.             </div>
  90.         </div>
  91.    
  92.         <br />
  93.    
  94.         <?php while (have_posts()) : the_post(); ?>
  95.         <div class="small-12 medium-4 large-4 columns">
  96.         <div <?php //post_class(); ?> class="category-article-block">
  97.        
  98.         <a href="#">
  99.         <div class="category-article-thumbnail">
  100.             <div class="view third-effect">
  101.                 <?php the_post_thumbnail(); ?>
  102.                 <div class="mask">
  103.                     <a href="<?php the_permalink() ?>" class="info" title="View Article"><i class="fa fa-search"></i></a>
  104.                 </div>
  105.                 <div class="category-label"><?php single_cat_title( '', true ); ?></div>
  106.                 <!-- <i class="category-label-end"></i> -->
  107.             </div>
  108.         </div>
  109.         </a>
  110.        
  111.             <div class="category-article-content">
  112.                 <h5 class="category-article-title" id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__('%s'), the_title_attribute('echo=0')); ?>"><?php the_title(); ?></a></h5>
  113.                 <small><?php //the_time(__('l, F jS, Y', 'kubrick')) ?></small>
  114.  
  115.                 <div class="category-article-excerpt">
  116.                     <?php //the_excerpt() ?>
  117.                 </div>
  118.  
  119.                 <!-- <p class="postmetadata"><?php the_tags(__('Tags:', 'kubrick'), ', ', '<br />'); ?> <?php printf(__('Posted in %s', 'kubrick'), get_the_category_list(', ')); ?> | <?php edit_post_link(__('Edit', 'kubrick'), '', ' | '); ?>  <?php comments_popup_link(__('No Comments &#187;', 'kubrick'), __('1 Comment &#187;', 'kubrick'), __('% Comments &#187;', 'kubrick'), '', __('Comments Closed', 'kubrick') ); ?></p> -->
  120.                 <!-- <p class="postmetadata"><?php comments_popup_link(__('No Comments &#187;', 'kubrick'), __('1 Comment &#187;', 'kubrick'), __('% Comments &#187;', 'kubrick'), '', __('Comments Closed', 'kubrick') ); ?></p> -->
  121.                
  122.                 <div class="article-stats-info">
  123.                     <ul>
  124.                         <!-- <li><?php //the_author(); ?></li> -->
  125.                         <li><i class="fa fa-clock-o"></i> <?php the_date('Y-m-d') ?></li>
  126.                         <li><i class="fa fa-comments"></i> <?php comments_number( '0 comments', '1 comment', '% comments' ); ?></li>
  127.                     </ul>
  128.                 </div>
  129.                
  130.             </div>
  131.  
  132.         </div>
  133.         </div>
  134.        
  135.         <?php endwhile; ?>
  136.             <?php wpbeginner_numeric_posts_nav(); ?>
  137.         <?php else :
  138.  
  139.             if ( is_category() ) { // If this is a category archive
  140.                 printf("<h2 class='center'>".__("Sorry, but there aren't any posts in the %s category yet.", 'kubrick').'</h2>', single_cat_title('',false));
  141.             } else if ( is_date() ) { // If this is a date archive
  142.                 echo('<h2>'.__("Sorry, but there aren't any posts with this date.", 'kubrick').'</h2>');
  143.             } else if ( is_author() ) { // If this is a category archive
  144.                 $userdata = get_userdatabylogin(get_query_var('author_name'));
  145.                 printf("<h2 class='center'>".__("Sorry, but there aren't any posts by %s yet.", 'kubrick')."</h2>", $userdata->display_name);
  146.             } else {
  147.                 echo("<h2 class='center'>".__('No posts found.', 'kubrick').'</h2>');
  148.             }
  149.             get_search_form();
  150.             endif;
  151.         ?>
  152.     </div>
  153.    
  154.     <div class="small-3 hide-for-small-only columns">
  155.        
  156.         <?php if ( is_active_sidebar( 'category_sidebar' ) ) : ?>
  157.             <div id="secondary" class="widget-area posts-sidebar" role="complementary">
  158.             <?php dynamic_sidebar( 'category_sidebar' ); ?>
  159.             </div>
  160.         <?php endif; ?>
  161.        
  162.     </div>
  163.    
  164.     </div>
  165.    
  166. </div>
  167. </section>
  168.    
  169. <?php //get_sidebar(); ?>
  170.  
  171. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement