将Wordpress index.php链接到single.php

将Wordpress index.php链接到single.php,wordpress,blogs,Wordpress,Blogs,我正在开发一个网站,最初我是从头开始编写的,但现在我正在将wordpress与之集成,因为我的客户需要一个后端 这是我的问题,我正在使用index.php作为主要的博客文章(到目前为止还可以)。但是我想做的是只摘录一篇文章(一个简短的摘要),然后我希望用户能够点击“阅读更多”链接,以便获得该特定文章/文章的完整页面(我假设是single.php(如果我没有弄错的话) 下面是我在主博客页面上的代码(即index.php-我只包括与此相关的php代码,而不是整个页面): 博客 档案室 公布

我正在开发一个网站,最初我是从头开始编写的,但现在我正在将wordpress与之集成,因为我的客户需要一个后端

这是我的问题,我正在使用index.php作为主要的博客文章(到目前为止还可以)。但是我想做的是只摘录一篇文章(一个简短的摘要),然后我希望用户能够点击“阅读更多”链接,以便获得该特定文章/文章的完整页面(我假设是single.php(如果我没有弄错的话)

下面是我在主博客页面上的代码(即index.php-我只包括与此相关的php代码,而不是整个页面):


博客
档案室

公布日期:

这是我的single.php页面的代码:

<?php get_header(); ?>
    <section>
        <article id="white_bg">
            <div class="content_border">
                <div id="content">
                <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
                <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
                <p><?php the_post_thumbnail(); ?></p>
                <p><?php the_content(); ?></p>
                <p><?php _e('Filed under&#58;'); ?> <?php the_category(', ') ?> <?php _e('by'); ?> <?php  the_author(); ?></p>
                <p><?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?> <?php edit_post_link('Edit', ' &#124; ', ''); ?></p>
                <br />
                <?php comments_template(); ?>
                <?php endwhile; ?>
                <div>
                <?php previous_post_link('< %link') ?> <?php next_post_link(' %link >') ?>
                </div>
                <?php endif; ?>
            </div>
            </div>
        </article><!--end main article-->
    </section><!--end main content section-->
<?php get_footer(); ?>    


我希望人们能够看到摘要文章/帖子,并单击要带到single.php的read more链接,在那里他们可以查看完整的文章/帖子并发表评论。

如果您将其更改为名为_Extrapt()的提取函数,您可以在其中看到内容()。之后添加永久链接


如果您在这次访问中还需要更多信息

嗨,丹尼尔,首先……感谢您抽出时间阅读我的问题并回答。我确实尝试过使用“the_摘录”,效果很好。但我的问题是,当人们使用编码中的“the_摘录”点击“read more”链接时,该链接不会将用户带到其他页面这将显示整篇文章。相反,如果您将鼠标悬停在“阅读更多”链接上,它将链接到您已经在的同一页。很抱歉,我的问题不太清楚。任何其他帮助都将不胜感激。谢谢!
<?php get_header(); ?>
    <section>
        <article id="white_bg">
            <div class="content_border">
                <div id="content">
                <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
                <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
                <p><?php the_post_thumbnail(); ?></p>
                <p><?php the_content(); ?></p>
                <p><?php _e('Filed under&#58;'); ?> <?php the_category(', ') ?> <?php _e('by'); ?> <?php  the_author(); ?></p>
                <p><?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?> <?php edit_post_link('Edit', ' &#124; ', ''); ?></p>
                <br />
                <?php comments_template(); ?>
                <?php endwhile; ?>
                <div>
                <?php previous_post_link('< %link') ?> <?php next_post_link(' %link >') ?>
                </div>
                <?php endif; ?>
            </div>
            </div>
        </article><!--end main article-->
    </section><!--end main content section-->
<?php get_footer(); ?>