点击标题下方的标题显示更多内容


Show more content on click title underneath title

我需要在wordpress中显示帖子的内容。基本上,我需要在点击时显示一个div,但只显示当前的帖子。我有标题和摘录在页面上循环显示所有帖子。我只想显示当前标题文章点击的内容。下面的例子是我目前拥有的。

$(document).on('click', '.post-id', function() {
	$(myClass, ".post-content").show();
});
<div class="post-full">
<h2 class="post-id<?php //echo get_the_ID(); ?>"><?php the_title(); ?><div class="close">Close</div></h2>
<div class="post-excerpt"><h3><?php the_excerpt(); ?></h3></div>
<div class="post-content"><?php the_content(); ?></div>
</div>

如果我正确理解

$(document).on('click', '.post-id', function()
{
    var content = $(this).nextAll('.post-content');
    if (content.is(':visible'))
    {
        content.hide();
    }
    else
    {
        $('.post-content:visible').hide();
        content.show();
    }
});