Advertisement
Guest User

template-blog.php

a guest
Jan 3rd, 2013
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.54 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: Blog
  4. */
  5. get_header(); ?>
  6.  
  7.  
  8. <div id="content">
  9.     <div class="archive">
  10.  
  11.         <div class="title"><?php _e('Latest entries', 'thop'); ?><a href="javascript: void(0);" id="mode" class="<?php if ($_COOKIE['mode'] == 'grid') echo 'flip'; ?>"></a></div>
  12.  
  13.         <?php
  14.             $paged = get_query_var('paged') ? get_query_var('paged') : 1;
  15.             query_posts( array(
  16.                 'posts_per_page' => get_option( 'posts_per_page' ),
  17.                 'paged' => $paged
  18.             ) );
  19.         ?>
  20.  
  21.  
  22. <!-- start loop -->
  23. <?php if ( have_posts() ) : ?>
  24.  
  25.     <div class="loop">
  26.         <div id="loop" class="<?php if ($_COOKIE['mode'] == 'list' ) echo 'list'; else echo 'grid'; ?> clear">
  27.         <?php
  28.             $postedon_data = array(
  29.                 'date' => get_option('thop_postedon_date'),
  30.                 'category' => get_option('thop_postedon_cat'),
  31.                 'comment' => get_option('thop_postedon_comm'),
  32.                 'author' => get_option('thop_postedon_author')
  33.             );
  34.             $i = 0;
  35.             while ( have_posts() ) : the_post();
  36.                 $i++;
  37.         ?>
  38.                 <div id="post-<?php the_ID(); ?>" <?php post_class('clear'); ?>>
  39.                     <a href="<?php the_permalink(); ?>" class="post-thumb"><?php if ( has_post_thumbnail_by_blog() ) the_post_thumbnail_by_blog('general'); ?></a>
  40.                     <div class="post-meta"><?php if (function_exists('thop_posted_on')) thop_posted_on($postedon_data); ?></div>
  41.                     <h2><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
  42.                     <p><?php the_excerpt(); ?></p>
  43.                 </div>
  44.         <?php
  45.             if ( $i % 2 == 0 ) echo '<div class="clear"></div>';
  46.             endwhile; // end of the loop.
  47.         ?>
  48.             <div class="grid-line"></div>
  49.         </div><!-- #loop -->
  50.     </div><!-- .loop -->
  51.  
  52. <?php else : ?>
  53.  
  54.     <div class="loop">
  55.         <div id="post-0" class="post hentry error404 not-found clear">
  56.             <h2><?php _e( 'Not found', 'thop' ); ?></h2>
  57.             <p><?php _e( 'Apologies, but no results were found for the requested criteria. Perhaps searching will help find a related post.', 'thop' ); ?></p>
  58.         </div><!-- #post-0 -->
  59.     </div>
  60.  
  61. <?php endif; ?>
  62.  
  63. <!-- end loop -->
  64.  
  65.  
  66.         <?php get_template_part( 'pagination' ); ?>
  67.  
  68.         <?php wp_reset_query(); ?>
  69.        
  70.     </div> <!-- .archive -->
  71. </div> <!-- #content -->
  72.  
  73. <?php get_sidebar(); ?>
  74.  
  75. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement