当我设置页面-{slug}时,wordpress自定义页面有问题。php,它不工作,它显示索引的内容。在我将wordpress版本4.9.2更新为4.9.4之前,它一直有效
我确实重新安装了wordpress 4.9.2并再次尝试。它仍然不起作用
我怎样才能解决它。
指数php
<?php get_header(); ?>
<div class="container">
<?php masterslider(2); ?>
</div>
<?php get_footer(); ?>
第-{slug}页。php
<?php get_header("cpt"); ?>
<div class="container">
<?php if ( have_posts() ) : while ( have_posts() ) : the_post();
the_content();
endwhile; ?>
<?php endif; ?>
<div class="row">
<?php $loop = new WP_Query( array( \'post_type\' => \'cpt\', \'posts_per_page\' => 15 ) ); ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<li class="nolist"> <div class="posts">
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-4 col-xl-3">
<!--Card content-->
<div class="card" >
<!---thumbnails--->
<a href="<?php the_permalink(); ?>"> <?php
// Must be inside a loop.
if ( has_post_thumbnail() ) {
the_post_thumbnail();
}
else {
echo \'<img class="img-fluid" src="\' . get_bloginfo( \'stylesheet_directory\' )
. \'/img/ocg.jpg" class="img-responsive" />\';
}
?></a>
<!---- thumbnails end--->
<div class="card-body">
<h6 class="card-title"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?> </a></h6>
<hr>
<div class="text-center">
<a href="<?php the_permalink(); ?>"> read</a>
</div>
</div>
<div class="card-footer text-center">
<?php echo human_time_diff( get_the_time(\'U\'), current_time(\'timestamp\') ) ; ?>
</div>
</div>
<?php endwhile; ?></div>
</div></li></div>
</div>
<?php get_footer(); ?>