我希望能够显示超级粘性或粘性以上的论坛帖子。换句话说。我会在页面上有帖子,超级/粘性帖子会在那里。然而,在帖子列表之上,我希望超级/粘性帖子也在那里。有点像“特色讨论”类型的部分。
发布于 2012-08-15 06:40:55
所以我最终这样做是为了解决我的问题。我在表的上方添加了一个包含主题的div,然后执行了一些jquery,如下所示:
var rows = $('table.bbp-topics').find('tr.super-sticky');
rows.each(function(index) {
var headhref = $('a.bbp-topic-permalink', this).attr('href');
var headline = $('a.bbp-topic-permalink', this).html();
var excerpt = $('.excerpt', this).text();
var author = $('a.bbp-author-name', this).html();
var photo = $('a.bbp-author-avatar > img', this).attr('src');
var replies = $('.bbp-topic-voice-count', this).text();
var followers = $('.bbp-topic-reply-count', this).text();
var freshness = $('.bbp-topic-freshness > a', this).html();
var meta = $('p.bbp-topic-meta', this).text();
var newrow = '<div class="featured-row"><div class="topic-meta">' +
'<img class="author-photo" src ="' + photo + '">' +
'<div class="author">' + author +'</div> ' +
'<div class="topic-title"><a href="' + headhref + '">' + headline + '<a/></div>' +
'<div class="excerpt">' + excerpt + '</div></div>' +
'<div class="replies"><h3>Replies</h3><hr/><p>' + replies + '</p></div> ' +
'<div class="followers"><h3>Followers</h3><hr/><p>' + followers + '</p></div> ' +
'<div class="freshness"><h3>Updated</h3><hr/><p>' + freshness + '</p></div> ' +
' </div>';
console.log(newrow);
$('#supersticky').fadeIn().append(newrow)
})希望这对其他人有所帮助。
发布于 2018-11-13 03:32:40
这里有一个更简单的答案,from this bbpress.org thread
$query = new WP_Query(array('post__in' => bbp_get_super_stickies());
https://stackoverflow.com/questions/11940386
复制相似问题