Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/73.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 Wordpress-Can';我看不到个别职位_Php_Html_Wordpress_Post - Fatal编程技术网

Php Wordpress-Can';我看不到个别职位

Php Wordpress-Can';我看不到个别职位,php,html,wordpress,post,Php,Html,Wordpress,Post,我正在为我的网站开发一个自定义的WordPress主题,我遇到了一个障碍。我已经设置了一个新闻页面来显示帖子。这些帖子在新闻页面上显示正确,但当我点击帖子本身的链接时,它完全是空白的。这会让我找到正确的URL,但是帖子的页面是完全白色的。我已经尝试切换到另一个主题,它显示得很好,我似乎找不到任何其他在线用户有这个问题,所以我很确定我在主题上犯了一些非常愚蠢的错误 我使用的代码非常基本(目前在index.php中): 为此,您必须在主题文件夹中创建一个single.php文件并粘贴代码 <d

我正在为我的网站开发一个自定义的WordPress主题,我遇到了一个障碍。我已经设置了一个新闻页面来显示帖子。这些帖子在新闻页面上显示正确,但当我点击帖子本身的链接时,它完全是空白的。这会让我找到正确的URL,但是帖子的页面是完全白色的。我已经尝试切换到另一个主题,它显示得很好,我似乎找不到任何其他在线用户有这个问题,所以我很确定我在主题上犯了一些非常愚蠢的错误

我使用的代码非常基本(目前在index.php中):


为此,您必须在主题文件夹中创建一个
single.php
文件并粘贴代码

<div id="content" class="content_field">
<?php while (have_posts()): the_post(); ?>
    <div id="news_title">
        <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
    </div>
    <div id="news_body">
        <?php the_content(); ?>
    </div>
<?php endwhile; ?>
</div>



要显示单个帖子,您需要在主题中创建一个.php文件

在Single.php中输入以下代码:

<div id="primary" class="content-area">
<?php while ( have_posts() ) : the_post(); ?>
<header class="entry-header">
    <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
</header>
<div class="entry-content">
<?php the_content(); ?>
</div>
<?php endwhile; ?>


有一个单独的.php吗?请用single.php在你的主题中创建一个文件,并将相同的代码放在上面是的,这就是问题所在。非常感谢,我还是WordPress的初学者,所以noobie问题让我很痛苦@ZackAkai你有没有检查过我的密码?
<?php
/**
 * The Template for displaying all single posts
 *
 * @package WordPress
 * @subpackage Twenty_Twelve
 * @since Twenty Twelve 1.0
 */
get_header(); ?>

    <div id="primary" class="site-content">
        <div id="content" role="main">

            <?php while ( have_posts() ) : the_post(); ?>

                <div id="news_title">
                    <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
                </div>

                <div id="news_body">
                    <?php the_content(); ?>
                </div>

                <nav class="nav-single">
                    <h3 class="assistive-text"><?php _e( 'Post navigation', 'twentytwelve' ); ?></h3>
                    <span class="nav-previous"><?php previous_post_link( '%link', '<span class="meta-nav">' . _x( '&larr;', 'Previous post link', 'twentytwelve' ) . '</span> %title' ); ?></span>
                    <span class="nav-next"><?php next_post_link( '%link', '%title <span class="meta-nav">' . _x( '&rarr;', 'Next post link', 'twentytwelve' ) . '</span>' ); ?></span>
                </nav><!-- .nav-single -->

                <?php comments_template( '', true ); ?>

            <?php endwhile; // end of the loop. ?>

        </div><!-- #content -->
    </div><!-- #primary -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>
<div id="primary" class="content-area">
<?php while ( have_posts() ) : the_post(); ?>
<header class="entry-header">
    <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
</header>
<div class="entry-content">
<?php the_content(); ?>
</div>
<?php endwhile; ?>