好的,这个问题已被多次询问,但没有一个答案解决了我的问题。为了找出确切的问题,我来这里是为了得到你的帮助。我的帖子使用index.php而不是single.php来显示。
的index.php
<?php
/**
* The main template file.
*
* This is the most generic template file in a WordPress theme
* and one of the two required files for a theme (the other being style.css).
* It is used to display a page when nothing more specific matches a query.
* E.g., it puts together the home page when no home.php file exists.
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*
* @package AWE
*/
get_header();
?>
<div id="primary" class="container">
<main id="main" class="main-content col-md-9" role="main">
<?php if ( have_posts() ) : ?>
<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php
/*
* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part( 'template-parts/content', get_post_format() );
?>
<?php endwhile; ?>
<?php the_posts_navigation(); ?>
<?php else : ?>
<?php get_template_part( 'template-parts/content', 'none' ); ?>
<?php endif; ?>
</main><!-- #main -->
<?php get_sidebar(); ?>
</div><!-- #primary -->
<?php get_footer(); ?>
single.php中
<?php
/**
* The template for displaying all single posts.
*
* @package AWE
*/
get_header(); ?>
<!-- Blog head -->
<section id="blog-head" class="blog-head">
<div class="blog-head-section parallax-style clearfix">
<div class="parallax-overlay">
<div class="container">
<div class="fluid-section section-padding">
<h2 class="section-title"><?php echo esc_html(zels_get_option('blog_section_title')) ?></h2>
<div class="section-details text-center">
<?php echo esc_html(zels_get_option('blog_section_des')) ?>
</div><!-- /.section-details -->
</div><!-- /.fluid-section section-padding -->
</div><!-- /.container -->
</div><!-- /.parallax-overlay -->
</div><!-- /.blog-head-section -->
</section><!-- /#blog-head -->
<!-- Blog head End -->
<div class="content-area">
<div class="container">
<div class="row">
<!-- Main Container -->
<div id="main-content" class="main-content col-md-12">
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'template-parts/content', 'single' ); ?>
<?php
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
?>
<?php endwhile; // End of the loop. ?>
</div>
<?php get_sidebar(); ?>
</div>
</div><!-- #container -->
</div><!-- #content-area -->
<?php get_footer(); ?>
之前工作正常,直到客户更新了帖子的内容。我想知道帖子在什么情况下使用各种模板在前端显示。