Show / hide button appears only for the initial post

0

In the first post, it appears normally, but when I click on the others, only the content of the first post appears.

<?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(); ?>
    
asked by anonymous 06.10.2016 / 01:33

0 answers