简体   繁体   中英

Wordpress single.php shows post title but no content

Hi there I was wondering if anyone could assist me quickly.

I am working on a clients site and all of a sudden the blog posts only show the title and not the content.

I am not sure why and need some assistance.

here is the code for the 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 -->

Thank you for your help.

*Edit

Here is the content-single.php code

<?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(); ?> -->'

You should include the_content() ; in the place you want the content to appear. Something like this:

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

Also, in the file content-single.php comment out (or delete) these lines:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM