Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/296.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显示文章标题,但不显示内容_Php_Wordpress_Post_Blogs - Fatal编程技术网

php显示文章标题,但不显示内容

php显示文章标题,但不显示内容,php,wordpress,post,blogs,Php,Wordpress,Post,Blogs,你好,我想知道是否有人能尽快帮助我 我在一个客户网站上工作,突然间,博客帖子只显示标题,而没有显示内容 我不知道为什么,需要一些帮助 下面是single.php的代码 <div id="primary" class="content-area"> <?php get_template_part( 'content', 'single' ); ?> <div id="content" class="site-content" ro

你好,我想知道是否有人能尽快帮助我

我在一个客户网站上工作,突然间,博客帖子只显示标题,而没有显示内容

我不知道为什么,需要一些帮助

下面是single.php的代码

    <div id="primary" class="content-area">

    <?php get_template_part( 'content', 'single' ); ?>


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

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



            <?php nightwatch_content_nav( 'nav-below' ); ?>

            <?php
                // If comments are open or we have at least one comment, load up the comment template
                if ( comments_open() || '0' != get_comments_number() )
                    comments_template( '', true );
            ?>

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

        </div><!-- #content .site-content -->
    </div><!-- #primary .content-area -->

谢谢你的帮助

*编辑

下面是content-single.php代码

<?php
/**
* @package nightwatch
* @since nightwatch 1.0.2
*/
?>

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
    <h1 class="entry-title"><?php the_title(); ?></h1>

    <div class="entry-meta">
        <?php nightwatch_posted_on(); ?>
    </div><!-- .entry-meta -->
</header><!-- .entry-header -->

<div class="entry-content">
    <?php the_content(); ?>
    <?php wp_link_pages( array( 'before' => '<div class="page-links">' . __(               '    Pages:', 'nightwatch' ), 'after' => '</div>' ) ); ?>
</div><!-- .entry-content -->

<footer class="entry-meta">
    <?php
        /* translators: used between list items, there is a space after the           comma */
        $category_list = get_the_category_list( __( ', ', 'nightwatch' ) );

        /* translators: used between list items, there is a space after the comma */
        $tag_list = get_the_tag_list( '', ', ' );

        if ( ! nightwatch_categorized_blog() ) {
            // This blog only has 1 category so we just need to worry    about tags in the meta text
            if ( '' != $tag_list ) {
                $meta_text = __( 'This entry was tagged %2$s.     Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.',    'nightwatch' );
            } else {
                $meta_text = __( 'Bookmark the <a href="%3$s"   title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'nightwatch' );
            }

        } else {
            // But this blog has loads of categories so we should    probably display them here
            if ( '' != $tag_list ) {
                $meta_text = __( 'This entry was posted in %1$s and    tagged %2$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'nightwatch' );
            } else {
                $meta_text = __( 'This entry was posted in %1$s. 
Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.',   'nightwatch' );
            }

        } // end check for categories on this blog

        printf(
            $meta_text,
            $category_list,
            $tag_list,
            get_permalink(),
            the_title_attribute( 'echo=0' )
        );
    ?>

    <?php edit_post_link( __( 'Edit', 'nightwatch' ), '<span class="edit-    link">', '</span>' ); ?>
</footer><!-- .entry-meta -->
</article><!-- #post-<?php the_ID(); ?> -->'

","夜更",;
}否则{
$meta_text=uuu('Bookmark the.','nightwatch');
}
}否则{
//但是这个博客有很多类别,所以我们应该在这里展示它们
如果(“”!=$tag_列表){
$meta_text=_uuu('此条目在%1$s中发布,并标记为%2$s。将其作为书签。','nightwatch');
}否则{
$meta_text=\u_('此条目已在%1$s中发布。
将“,”夜表“)标记为书签;
}
}//结束此博客上类别的检查
printf(
$meta_文本,
$category_列表,
$tag_列表,
get_permalink(),
_title_属性('echo=0')
);
?>
你应该包括;在您希望内容显示的位置。大概是这样的:

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

此外,在文件content-single.php中注释(或删除)以下行:

<div class="entry-content">
    <?php the_content(); ?>
    <?php wp_link_pages( array( 'before' => '<div class="page-links">' . __(               '    Pages:', 'nightwatch' ), 'after' => '</div>' ) ); ?>
</div><!-- .entry-content -->

你应该包括;在您希望内容显示的位置。大概是这样的:

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

此外,在文件content-single.php中注释(或删除)以下行:

<div class="entry-content">
    <?php the_content(); ?>
    <?php wp_link_pages( array( 'before' => '<div class="page-links">' . __(               '    Pages:', 'nightwatch' ), 'after' => '</div>' ) ); ?>
</div><!-- .entry-content -->


下面是一个示例,您确定这是来自single.php.的调用吗。。?它可能是page.php…是的,它是从single.php调用的,因为当我对single.php进行编辑时,比如放入面包屑,你可以在网页上看到明显的差异。下面是一个示例,你确定这是从single.php调用的吗。。?它可能是page.php…是的,它是从single.php调用的,因为当我对single.php进行编辑时,比如放入面包屑,你可以在网页上看到明显的差异。很棒的建议!现在唯一的问题是有两个共享按钮栏,因此我感觉代码中的其他地方正在调用内容。我怎样才能摆脱额外的社交共享栏呢?这一行的get_template_部分('content','single');调用一个额外的文件!你能找到它并分享它的代码吗?当然我会编辑原始消息并包含content-post.php代码。谢谢你迄今为止的帮助!好极了这已经很好地工作了,额外的共享栏已经被删除了!如果可能的话,你能告诉我为什么H1的标题不采用绿色字体格式吗?我很高兴它能工作!对于颜色,请转到742行中的style.css文件,将颜色更改为#90C73E。非常好的建议!现在唯一的问题是有两个共享按钮栏,因此我感觉代码中的其他地方正在调用内容。我怎样才能摆脱额外的社交共享栏呢?这一行的get_template_部分('content','single');调用一个额外的文件!你能找到它并分享它的代码吗?当然我会编辑原始消息并包含content-post.php代码。谢谢你迄今为止的帮助!好极了这已经很好地工作了,额外的共享栏已经被删除了!如果可能的话,你能告诉我为什么H1的标题不采用绿色字体格式吗?我很高兴它能工作!对于颜色,请转到第742行中的style.css文件,将颜色更改为#90C73E。