0
In the first post, appears normally, but when I click on others, appears only the contents of the first post.
<?php get_header(); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div id="caixapost">
<div class="title" style="height: 27px;">
<?php the_title(); ?>
<button title="Clique para mostrar/ocultar" type="button" onclick="if(document.getElementById('spoiler') .style.display=='none') {document.getElementById('spoiler') .style.display=''}else{document.getElementById('spoiler') .style.display='none'}">+</button>
</div>
<div id="spoiler" style="display:none"><?php the_content(); ?></div>
</div>
<?php endwhile; else: ?>
<?php endif; ?></div>
<?php get_footer(); ?>
From what I understand you ride the div’s inside a while right? so that way several div’s are getting the id spoiler. The id should be unique, so it is only recognizing the first.
– Bia
How can I do using the while?
– Alexandre Santos
What sql information you have inside while?
– Bia