index.php中没有博客摘录

时间:2013-02-07 01:40:56

标签: wordpress

简单来说,按照教程,我没有达到“主要内容”的部分,但就像我通常那样,我跳了起来,把主要内容放在侧边栏中。所以在我的“php get_sidebar()”中,我有我的主要内容和我的一边。即使它不是理想的格式,我的页面看起来还不错。博客正在展示,一切都很好。请注意,我的“php the_excerpt()”是我的主要内容,但一切都还是不错的。然后我们到达他所说的部分,创建一个home.php页面并将我的主要内容放在那里,这个内容与php get_header& php get_sidebar就像它应该的那样。我认为我的主要内容从我的侧边栏到home.php很简单(基本上将所有内容从index.php复制到home.php中,将我的主要内容从我的侧边栏中提取出来放在里面home.php)

<?php get_header(); ?>

<section>
    THIS IS MY TRUNCATED MAIN CONTENT

    <div id="posts" class="regions">
        <?php query_posts("posts_per_page=1"); ?>
        <h4><span>Blog</span> City</h4>
        <div id="post_content">
            <p><?php the_date(); ?></p>
            <img src ="<?php bloginfo('template_directory'); ?     >/images/midpic.jpg" width="200px" height="118px"/> 
            <h5><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h5>
            <p><?php the_excerpt(); ?></p>
        </div>
    </div>


<!--<?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('Sidebar   Widgets')) : else : ?>-->
    <!-- All this stuff in here only shows up if you DON'T have any widgets active in this zone --> 
<!--<?php endif; ?>-->


</section> <!--End of Section-->

<?php get_sidebar(); ?>

<?php get_footer(); ?> 

所以我的问题是博客和日期显示的时候它不正确但现在它在home.php并且格式正确,php the_date和php the_excerpt没有显示。有关哪个页面显示我的博客的任何规格?还有,我在index.php和home.php以及没有骰子的情况下尝试过这个。但是如果我把我的主要内容放回边栏一切都很好。任何指针都将非常感激。

1 个答案:

答案 0 :(得分:0)

也许我错过了什么,但home.php用于什么?通常,单个帖子模板文件称为single.php。

此外,对于完整帖子,您应该使用<?php the_content(); ?>

the_excerpt()the_content()上的文档。

相关问题