Php WordPress在主页中获取帖子
我正试着用这样的手风琴来获取帖子Php WordPress在主页中获取帖子,php,wordpress,twitter-bootstrap,Php,Wordpress,Twitter Bootstrap,我正试着用这样的手风琴来获取帖子 <div class="container"> <div class="panel-group" id="accordion"> <?php if ( have_posts() ) : // Start the Loop. while ( have_posts() ) :the_post ();?>
<div class="container">
<div class="panel-group" id="accordion">
<?php
if ( have_posts() ) :
// Start the Loop.
while ( have_posts() ) :the_post ();?>
<div class='col-md-12 col-xs-12'>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="false" class="collapsed"><?php echo the_title()?></a>
</h4>
</div>
<div id="collapseOne" class="panel-collapse collapse" aria-expanded="false" style="height: 0px;">
<div class="panel-body">
<p><?php echo the_content()?></p>
</div>
</div>
</div>
<?php
get_template_part( 'content', get_post_format() );
endwhile;
twentyfourteen_paging_nav();
else :
// If no content, include the "No posts found" template.
get_template_part( 'content', 'none' );
endif;
?>
</div>
<?php // get_sidebar( 'content' ); ?>
</div>
现在的问题是,一旦文章内容被印在手风琴内,它又被印在了手风琴外
您能否删除echo并只编写
内容()
获取模板部分
可能会获取一个模板文件(例如content.php),其中也调用了内容()
。尝试注释掉这一行:get_template_part('content',get_post_format())
您是否可以删除echo并只编写内容()
获取模板部分
可能会获取一个模板文件(例如content.php),其中也调用了内容()
。尝试注释掉这一行:get_template_part('content',get_post_format())代码>