Guest User

archive.php

a guest
Sep 9th, 2012
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.92 KB | None | 0 0
  1. <?php get_header(); ?>
  2. <div class="span-24" id="contentwrap">
  3.     <div class="span-16">
  4.         <div id="content"> 
  5.  
  6.         <?php if (have_posts()) : ?>
  7.  
  8.       <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
  9.       <?php /* If this is a category archive */ if (is_category()) { ?>
  10.         <h2 class="pagetitle">Архив категории &#8216;<?php single_cat_title(); ?>&#8217; </h2>
  11.       <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
  12.         <h2 class="pagetitle">Записи помеченные &#8216;<?php single_tag_title(); ?>&#8217;</h2>
  13.       <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
  14.         <h2 class="pagetitle">Архив за <?php the_time('j F Y'); ?></h2>
  15.       <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
  16.         <h2 class="pagetitle">Архив за <?php the_time('F, Y'); ?></h2>
  17.       <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
  18.         <h2 class="pagetitle">Архив <?php the_time('Y'); ?> года</h2>
  19.       <?php /* If this is an author archive */ } elseif (is_author()) { ?>
  20.         <h2 class="pagetitle">Архив автора</h2>
  21.       <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
  22.         <h2 class="pagetitle">Архив блога</h2>
  23.       <?php } ?>
  24.  
  25.         <?php while (have_posts()) : the_post(); ?>
  26.         <div <?php post_class() ?>>
  27.                 <?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) { the_post_thumbnail(array(260,200), array("class" => "alignleft post_thumbnail")); } ?>
  28.                 <h2 class="title" id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Постоянная ссылка на <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
  29.                 <div class="postdate"><img src="<?php bloginfo('template_url'); ?>/images/date.png" /> <?php the_time('j F Y') ?> <img src="<?php bloginfo('template_url'); ?>/images/user.png" /> <?php the_author() ?> <?php if (current_user_can('edit_post', $post->ID)) { ?> <img src="<?php bloginfo('template_url'); ?>/images/edit.png" /> <?php edit_post_link('Редактировать', '', ''); } ?></div>
  30.  
  31.                 <div class="entry">
  32.                     <?php the_excerpt() ?>
  33.                 </div>
  34.  
  35.                 <div class="postmeta"><img src="<?php bloginfo('template_url'); ?>/images/folder.png" /> Категория: <?php the_category(', ') ?> <?php if(get_the_tags('Метки:', ', ', '')) { ?> <img src="<?php bloginfo('template_url'); ?>/images/tag.png" /> <?php  the_tags('Метки: ', ', '); } ?>  <img src="<?php bloginfo('template_url'); ?>/images/comments.png" /> <?php comments_popup_link('Оставить комментарий!', 'Комментарии (1)', 'Комментарии (%)'); ?></div>
  36.  
  37.             </div>
  38.  
  39.         <?php endwhile; ?>
  40.        
  41.         <div class="navigation">
  42.             <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } else { ?>
  43.             <div class="alignleft"><?php next_posts_link('&laquo; Предыдущие записи') ?></div>
  44.             <div class="alignright"><?php previous_posts_link('Следующие записи &raquo;') ?></div>
  45.             <?php } ?>
  46.         </div>
  47.     <?php else :
  48.  
  49.         if ( is_category() ) { // If this is a category archive
  50.             printf("<h2 class='pagetitle'>Извините, но в категории %s записей не нашлось.</h2>", single_cat_title('',false));
  51.         } else if ( is_date() ) { // If this is a date archive
  52.             echo("<h2 class='pagetitle'>Извините, но записей с указанной датой не существует.</h2>");
  53.         } else if ( is_author() ) { // If this is a category archive
  54.             $userdata = get_userdatabylogin(get_query_var('author_name'));
  55.             printf("<h2 class='pagetitle'>Извините, но нет записей от автора %s.</h2>", $userdata->display_name);
  56.         } else {
  57.             echo("<h2 class='pagetitle'>Не найдено</h2>");
  58.         }
  59.  
  60.     endif;
  61. ?>
  62.  
  63.         </div>
  64.         </div>
  65.  
  66.  
  67. <?php get_sidebars(); ?>
  68.     </div>
  69. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment