基本上我想以这种格式按月显示帖子。我已经在这个网站上搜索和搜索了几个小时,但我找不到一个正是我想要的解决方案。任何帮助是极大的赞赏。谢谢!
我在 HTML 中尝试做的事情 -
<!--JUNE-->
<a href="#" class="trigger current">June 2013</a>
<div class="pane wdiv">
<ul>
<li>Post Title</li>
<li>Post Title</li>
</ul>
<ul>
<li>Post Title</li>
<li>Post Title</li>
</ul>
<ul>
<li>Post Title</li>
<li>Post Title</li>
</ul>
<div style="clear:both;"></div>
</div>
<!--May-->
<a href="#" class="trigger current">May 2013</a>
<div class="pane wdiv">
<ul>
<li>Post Title</li>
<li>Post Title</li>
</ul>
<ul>
<li>Post Title</li>
<li>Post Title</li>
</ul>
<ul>
<li>Post Title</li>
<li>Post Title</li>
</ul>
<div style="clear:both;"></div>
</div>
在过去的 3 个小时里,我一直在尝试和玩弄什么,但没有运气 -
<?php global $post;
$args = array( 'numberposts' => 5,);
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post); ?>
<?php the_date('F Y','<a href="#" class="trigger current">','</a>'); ?>
<div class="pane wdiv">
<ul>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
</ul>
<div style="clear:both;"></div>
</div>
<?php endforeach; ?>
正在显示什么
<!--JUNE-->
<a href="#" class="trigger current">June 2013</a>
<div class="pane wdiv">
<ul>
<li>Test Post</li>
</ul>
<div style="clear:both;"></div>
</div>
<div class="pane wdiv">
<ul>
<li>Test Post2</li>
</ul>
<div style="clear:both;"></div>
</div>
<!--May-->
<a href="#" class="trigger current">May 2013</a>
<div class="pane wdiv">
<ul>
<li>Awesome Video</li>
</ul>
<div style="clear:both;"></div>
</div>
<div class="pane wdiv">
<ul>
<li>Recommended Readings</li>
</ul>
<div style="clear:both;"></div>
</div>
<div class="pane wdiv">
<ul>
<li>Recommended Readings</li>
</ul>
<div style="clear:both;"></div>
</div>