Clicking the "View More" button needs to make the div containing the post text expand, if it affects the div on the side.
I tried to use toggleClass()
however the two open at the same time, or using an id only the first one opens.
js
jQuery(document).ready(function($){$('#btn-open-post').click(function(event){$('#post-collapse').toggleClass('post-collapse');});});
html
<divclass="blog">
<h2 class="blog-latest">últimas do blog</h2>
<div class="row">
<?php echo do_shortcode( '[dois_ultimos]' ); ?>
</div>
<a href="/blog/" class="all-posts">ver todas</a>
</div>
</div>
php
function dois_ultimos_posts()
{
global $post;
$html = "";
$dois_ultimos = new WP_Query( array(
'post_type' => 'post',
'posts_per_page' => 2
));
if( $dois_ultimos->have_posts() ) : while( $dois_ultimos->have_posts() ) : $dois_ultimos->the_post();
$html .= "<div class='col-md-6 post-home' >";
$html .= "<a href=\"" . get_permalink() . "\" class=\"post-permalink\"> <h3 class='post-title'>" . get_the_title() . " </h3>" . "</a>";
$html .= "<p class='post-resume' id='post-collapse'>" . get_the_content() . "</p>";
$html .= "<button id='btn-open-post' class='btn-open-post' id=\"" .get_the_ID() . "\" >Ver mais</button> ";
$html .= "<div class='overlay-blog-post'> </div> ";
$html .= "</div>";
endwhile; endif;
return $html;
}