尽管模板更改和阅读设置已更改,但博客页面仍显示为主页/登录页面

时间:2012-05-22 作者:user1255049

Live site.

我很难准确指出为什么博客页面会显示为主页/登录页。我已将页面模板更改为常规/页面。php和将WP阅读设置设置为首页为Static/Home,将贴子页面设置为Blog。有什么想法吗?我设置为使用通用模板的所有其他页面都这样做了,没有问题。

指数php

<?php get_header(); ?>

<div id="container">
    <div id="landing">
        <div id="intro">
            <h1>Hi, I\'m Dylan Elchami-<br />a health and fitness enthusiast with a passion for inspiring.</h1>
            <p>My interests are vast and ever changing, but my virtues remain true. I love to motivate, create, make people healthier, stronger, sexier, and flat out better all while building great, unmitigated relationships along the way. Please roam my site and enjoy all the information I post for you, and if you have a question please don\'t hesitate to contact me- it\'s your way of giving back for all the free information because helping you is what makes me feel AWESOME.</p>
        </div><!-- end intro -->

        <div id="stay-in-touch">
            <p>Stay in touch-</p>
            <ul>
                <li><a href="#"><img src="<?php echo get_template_directory_uri(); ?>/img/facebook.png" alt="Like on Facebook" /></a></li>
                <li><a href="#"><img src="<?php echo get_template_directory_uri(); ?>/img/twitter.png" alt="Follow on Twitter" /></a></li>
                <li><a href="#"><img src="<?php echo get_template_directory_uri(); ?>/img/linkedin.png" alt="Connect on LinkedIn" /></a></li>
            </ul>
        </div><!-- end stay-in-touch -->

        <?php $my_query = new WP_Query( array( \'posts_per_page\' => 3, \'nopaging\' => true ) );
        echo $post_count;
        while ( $my_query->have_posts() ) : ( $my_query->the_post() ); ?>
        <div id="preview">
            <div id="preview-item">
                <div id="preview-headline">
                <a href="<?php the_permalink(); ?>"><?php the_title(); ?>
            </div><!-- end preview-headline -->
            <div id="preview-thumbnail">
                <?php the_post_thumbnail( array(120,102) ); ?> 
            </div><!-- end preview-thumbnail -->
            </div><!-- end preview-item --> 
        </div><!-- end preview-->
        <?php endwhile; ?>
    </div><!-- end landing -->

<?php get_sidebar(); ?>

<?php get_footer(); ?>
第页。php

<?php
/*
Template Name: General
*/
?>

<?php get_header(); ?>

<div id="container">
    <div id="single">
        <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
        <?php endwhile; ?>
        <?php else : ?>
            <p>I\'m not sure what you\'re looking for.</p>
        <?php endif; ?>

        <div id="headline">
            <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></h2>
        </div><!-- end headline -->
        <div id="post-meta">
                <p>written by <?php the_author(); ?> on <?php the_date(); ?></p>
        </div><!-- end post-meta -->
        <div id="post">
            <?php the_content(\'read more...\'); ?>
        </div><!-- end post -->
    </div><!-- end single -->
</div><!-- end container -->

<?php get_sidebar(); ?>

<?php get_footer(); ?>

1 个回复
最合适的回答,由SO网友:mrwweb 整理而成

你应该仔细阅读template hierarchy.

page.php 自动用于所有静态页面。它不应包含“模板名称”标题。

home.php 用于设置博客页面的样式。它应该有一个可以处理多个项目的循环。

front-page.php 用于设置静态主页的样式。

index.php 是上述所有文件的回退模板。

结束

相关推荐

homepage loading too slow

我将一个网站转移到VPS,当我打开该网站时,主页的加载时间太长,对我来说,仅仅显示主页需要30-35秒,但当我以正常速度浏览它加载的内部页面时,我也尝试了这一方法,当时我的所有插件都已停用,但没有变化,加载需要时间。