Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/237.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 从permalink重定向时Wordpress帖子未显示标题_Php_Wordpress - Fatal编程技术网

Php 从permalink重定向时Wordpress帖子未显示标题

Php 从permalink重定向时Wordpress帖子未显示标题,php,wordpress,Php,Wordpress,我创造了自己的主题。在我的首页index.php上,我展示了一段文章,最后是“阅读更多”链接。因此,当我单击“阅读更多”时,我会被重定向到该帖子的页面localhost/wordpress/2014/post title/,但在那里,我看不到该帖子的标题,而是所有内容 index.php中代码段的代码 那么我如何才能在那里获得文章标题呢?我认为人们无法用这些代码帮助您解决这个问题。如果那篇文章的页面没有显示文章标题,那么您需要检查single.php 您可能忘记了在single.php文件中添加

我创造了自己的主题。在我的首页index.php上,我展示了一段文章,最后是“阅读更多”链接。因此,当我单击“阅读更多”时,我会被重定向到该帖子的页面localhost/wordpress/2014/post title/,但在那里,我看不到该帖子的标题,而是所有内容

index.php中代码段的代码


那么我如何才能在那里获得文章标题呢?

我认为人们无法用这些代码帮助您解决这个问题。如果那篇文章的页面没有显示文章标题,那么您需要检查single.php


您可能忘记了在single.php文件中添加该部分。

您的主题中有single.php吗?如果你这样做,请张贴其代码以及。哦!我没有包含该文件。我的主题文件夹中没有单个.php文件。是否需要添加?是的,Single.php对于任何主题都很重要,除非您使用的是子主题。
<div id="blog" class="container">

        <?php query_posts('showposts=3'); ?>
        <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>

        <div class="post col-md-4">
        <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>

            <div class="entry">  
                <?php the_post_thumbnail(); ?>

                <?php the_excerpt(__('(more…)')); ?>
                <p class="postmetadata">
                <?php _e('Filed under&#58;'); ?> <?php the_category(', ') ?> <?php _e('by'); ?> <?php  the_author(); ?><br />
                <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?> <?php edit_post_link('Edit', ' &#124; ', ''); ?>

                </p>

            </div>
        </div>
<?php endwhile; ?>

        <div class="navigation">
        <?php posts_nav_link(); ?>
        </div>

        <?php endif; ?>


    </div>