<?php

$args = array('type' => 'post', 'child_of' => 0, 'parent' => '', 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => 0, 'hierarchical' => 1, 'exclude' => '', 'include' => '', 'number' => '', 'taxonomy' => 'category', 'pad_counts' => false);
// 根据URL 获得第二个参数
$second_param = splitUrl($_GET['q'])[1];
// 获得第三个参数
$third_param = splitUrl($_GET['q'])[2];
// 每页要显示多少条文章
// 和总共有多少篇文章
$each_per = 10000000;
$posts_count = custom_get_category()->category_count;
$pages = ceil($posts_count / $each_per);
$page = validatorPage($posts_count, $each_per, $_GET['paged']);
if ($second_param == 'category') {
    /*'posts_per_page' => $each_per, 'paged' => $page*/
    $query = new WP_Query(array('category_name' => $third_param));
    if ($query->have_posts()) {
        include TEMPLATEPATH . '/template/archives.php';
    } else {
        include TEMPLATEPATH . '/template/empty_archives.php';
    }
} else {
    if ($second_param == 'tag') {
        include TEMPLATEPATH . '/template/tags.php';
    } else {
        if (is_numeric($second_param)) {
            // 如果是文章
            $post = get_post($second_param);
            if ($post) {
                include TEMPLATEPATH . '/template/post.php';
            } else {
?>
篇</p>
  <div>
    <?php 
while ($query->have_posts()) {
    ?>
      <?php 
    $query->the_post();
    ?>
      <div class='archives-list-item'>
        <a href='<?php 
    echo get_permalink($query->post->ID);
    ?>
'>
          <article class='archives-excerpt'><?php 
    echo custom_get_post_excerpt(the_excerpt(), strtoupper(custom_get_category()->slug));
    ?>
</article>
        </a>
        <div class='archives-list-item-title'>
          <a href='<?php 
    echo get_the_permalink($post);
    ?>
' class='sidebar-link'><?php 
    echo get_the_title();
    ?>
</a>
        </div>
        <section class='archives-list-item-footer'>
          <div class='archives-list-item-footer-item-left'>
          <div class='archives-list-item-footer-item'><?php