存档页面无效(WordPress)

时间:2014-03-13 04:35:50

标签: php wordpress wordpress-theming

我的档案页面有问题。请参阅:页面加载(如标题所示):http://plugcitarios.com/category/eventos/和此处http://plugcitarios.com/category/entretenimento/但内容/帖子在我选择的每个类别都相同。

这是 header.php

<!DOCTYPE html>
<html lang="<?php bloginfo('language'); ?>">

    <head>

        <meta charset="<?php bloginfo('charset'); ?>">

        <title><?php wp_title(''); ?></title>

        <link href="<?php echo get_template_directory_uri(""); ?>/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css" />

        <?php wp_head(); ?> 

    </head>

    <body <?php body_class(); ?>>

        <header class="full-width">

            <div class="container">

                <div class="logo">
                    <h1><a href="http://plugcitarios.com/"><img src="<?php echo get_template_directory_uri(""); ?>/images/logo.png"></a></h1>
                </div>

                <div class="social">
                    <ul>
                        <li><a href="http://instagram.com/plugcitarios"><img src="<?php echo get_template_directory_uri(""); ?>/images/social-instagram.png"></a></li>
                        <li><a href="http://facebook.com/plugcitarios"><img src="<?php echo get_template_directory_uri(""); ?>/images/social-facebook.png"></a></li>
                        <li><a href="http://www.twitter.com/plugcitarios_"><img src="<?php echo get_template_directory_uri(""); ?>/images/social-twitter.png"></a></li>
                        <li><a href="http://www.youtube.com/user/plugcitariostv"><img src="<?php echo get_template_directory_uri(""); ?>/images/social-youtube.png"></a></li>
                        <li><a href="http://feeds.feedburner.com/plugcitarios"><img src="<?php echo get_template_directory_uri(""); ?>/images/social-feed.png"></a></li>


        </ul>
            </div>

        </div>

    </header>

    <?php global $post;

    if ( is_home() ) { ?>

    <section class="content container">

        <?php query_posts('category_name=destaque&posts_per_page=1'); ?>
        <?php while (have_posts()) : the_post(); ?>
        <div class="imagem-destaque">
            <a href="<?php the_permalink() ?>"><?php 
                if ( has_post_thumbnail() ) { 
                    the_post_thumbnail( 'home1' ); 
                } 
            ?></a>
            <div class="meta-destaque">
                <span class="categoria-destaque"><ul>
                            <li>
                            <?php 
                                $category = get_the_category(); 
                                if($category[0]){
                                echo '<a href="'.get_category_link($category[0]->term_id ).'">'.$category[0]->cat_name.'</a>';
                                }
                                ?>
                            </li>
                        </ul></span>
                <h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Link permanente para <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
            </div>
        </div>
        <?php endwhile;?>

        <?php rewind_posts(); ?>
        <?php wp_reset_query(); ?>

        <?php query_posts('category_name=mini-destaque&posts_per_page=2'); ?>
        <?php while (have_posts()) : the_post(); ?>
        <div class="micro-destaque">
            <a href="<?php the_permalink() ?>"><?php 
                if ( has_post_thumbnail() ) { 
                    the_post_thumbnail( 'home2' ); 
                } 
            ?></a>
            <div class="micro-meta-destaque">
                <span class="micro-categoria-destaque"><ul>
                            <li>
                            <?php 
                                $category = get_the_category(); 
                                if($category[0]){
                                echo '<a href="'.get_category_link($category[0]->term_id ).'">'.$category[0]->cat_name.'</a>';
                                }
                                ?>
                            </li>
                        </ul></span>
                <h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Link permanente para <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
            </div>
        </div>
        <?php endwhile;?>

        <?php rewind_posts(); ?>
        <?php wp_reset_query(); ?>

    </section>

    <div class="clearfix"></div>

    <?php } else { ?>

    <?php } ?> 

    <nav class="container menu-topo">
        <?php wp_nav_menu( array('menu' => 'topo' )); ?>
    </nav>

这是 archive.php

<?php get_header(); ?>

        <section class="website-content container">

            <section class="posts">

                <?php rewind_posts(); ?>

                <?php 
                    if ( get_query_var('paged') ) { $paged = get_query_var('paged'); }
                    elseif ( get_query_var('page') ) { $paged = get_query_var('page'); }
                    else { $paged = 1; }

                    query_posts('posts_per_page=10&paged=' . $paged); 
                    ?>
                <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
                <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

                    <div class="meta">

                        <div class="date">
                            <?php the_time('j \d\e F') ?>
                        </div>

                        <div class="categoria">
                            <ul>
                                <li>
                                <?php 
                                    $category = get_the_category(); 
                                    if($category[0]){
                                    echo '<a href="'.get_category_link($category[0]->term_id ).'">'.$category[0]->cat_name.'</a>';
                                    }
                                    ?>
                                </li>
                            </ul>
                        </div>

                        <div class="author">
                            postado por <?php the_author_posts_link() ?>
                        </div>

                    </div>

                    <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Link permanente para <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>

                    <?php 
                    if ( has_post_thumbnail() ) {
                        the_post_thumbnail();
                    } 
                    ?>

                    <div class="text-article">

                        <?php the_excerpt(); ?>

                    </div>

                </article>
                <?php endwhile; else: ?>
                <article>
                    <p>Nenhum post encontrado.</p>
                </article>
                <?php endif; ?>

                <?php wp_pagenavi(); ?>

            </section>

            <aside class="sidebar">
                <?php get_sidebar(); ?>
            </aside>

        </section>

<?php get_footer(); ?>

任何想法? :(

1 个答案:

答案 0 :(得分:0)

这是index.php的一个错误。循环问题。修正了它。