在标题下方的点击标题上显示更多内容
Show more content on click title underneath title
我需要在wordpress中显示post的内容。基本上我需要在点击时显示 div,但只显示当前的 post。我在页面上循环显示标题和摘录以显示所有 post。我只想显示当前点击的标题 post 的内容。下面的示例是我目前拥有的。
$(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();
}
});
我需要在wordpress中显示post的内容。基本上我需要在点击时显示 div,但只显示当前的 post。我在页面上循环显示标题和摘录以显示所有 post。我只想显示当前点击的标题 post 的内容。下面的示例是我目前拥有的。
$(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();
}
});