当用户点击the_title();时,有 PHP 代码。然后the_content就会出现。
我的问题是,如果有无限the_title(); 和the_content(); ,生成 ID 存在问题,它必须是唯一的。
我如何生成href="#id"和id="id" ???
<?php
// Start the loop.
while ( have_posts() ) : the_post();
echo '<a href="#id" data-toggle="collapse">';
the_title();
echo '</a>
<div id="id" class="collapse">';
the_content();
echo '</div>';
// End of the loop.
endwhile;
?>