本文整理汇总了PHP中bbp_forums函数的典型用法代码示例。如果您正苦于以下问题:PHP bbp_forums函数的具体用法?PHP bbp_forums怎么用?PHP bbp_forums使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bbp_forums函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bbp_show_lead_topic
<li class="bbp-forum-reply-count"><?php
bbp_show_lead_topic() ? _e('Replies', 'bbpress') : _e('Posts', 'bbpress');
?>
</li>
<!--<li class="bbp-forum-freshness"><?php
/*_e( 'Freshness', 'bbpress' ); */
?>
</li> -->
</ul>
</li><!-- .bbp-header -->
<li class="bbp-body">
<?php
while (bbp_forums()) {
bbp_the_forum();
?>
<?php
bbp_get_template_part('loop', 'single-forum');
?>
<?php
}
?>
</li><!-- .bbp-body -->
<!---<li class="bbp-footer">
示例2: do_action
<?php
/**
* Forums Loop
*
* @package bbPress
* @subpackage Theme
*/
?>
<?php do_action( 'bbp_template_before_forums_loop' ); ?>
<?php while ( bbp_forums() ) : bbp_the_forum(); ?>
<?php bbp_get_template_part( 'loop', 'single-forum' ); ?>
<?php endwhile; ?>
<?php do_action( 'bbp_template_after_forums_loop' ); ?>
示例3: display_forums
/**
* Output the forums for a group in the edit screens
*
* As of right now, bbPress only supports 1-to-1 group forum relationships.
* In the future, many-to-many should be allowed.
*
* @since bbPress (r3653)
* @uses bp_get_current_group_id()
* @uses bbp_get_group_forum_ids()
* @uses bbp_has_forums()
* @uses bbp_get_template_part()
*/
public function display_forums($offset = 0)
{
global $wp_query;
// Allow actions immediately before group forum output
do_action('bbp_before_group_forum_display');
// Load up bbPress once
$bbp = bbpress();
/** Query Resets ******************************************************/
// Forum data
$forum_action = bp_action_variable($offset);
$forum_ids = bbp_get_group_forum_ids(bp_get_current_group_id());
$forum_id = array_shift($forum_ids);
// Always load up the group forum
bbp_has_forums(array('p' => $forum_id, 'post_parent' => null));
// Set the global forum ID
$bbp->current_forum_id = $forum_id;
// Assume forum query
bbp_set_query_name('bbp_single_forum');
?>
<div id="bbpress-forums">
<?php
switch ($forum_action) {
/** Single Forum **********************************************/
case false:
case 'page':
// Strip the super stickies from topic query
add_filter('bbp_get_super_stickies', array($this, 'no_super_stickies'), 10, 1);
// Unset the super sticky option on topic form
add_filter('bbp_get_topic_types', array($this, 'unset_super_sticky'), 10, 1);
// Query forums and show them if they exist
if (bbp_forums()) {
// Setup the forum
bbp_the_forum();
?>
<h3><?php
bbp_forum_title();
?>
</h3>
<?php
bbp_get_template_part('content', 'single-forum');
// No forums found
} else {
?>
<div id="message" class="info">
<p><?php
esc_html_e('This group does not currently have a forum.', 'bbpress');
?>
</p>
</div>
<?php
}
break;
/** Single Topic **********************************************/
/** Single Topic **********************************************/
case $this->topic_slug:
// hide the 'to front' admin links
add_filter('bbp_get_topic_stick_link', array($this, 'hide_super_sticky_admin_link'), 10, 2);
// Get the topic
bbp_has_topics(array('name' => bp_action_variable($offset + 1), 'posts_per_page' => 1, 'show_stickies' => false));
// If no topic, 404
if (!bbp_topics()) {
bp_do_404(bbp_get_forum_permalink($forum_id));
?>
<h3><?php
bbp_forum_title();
?>
</h3>
<?php
bbp_get_template_part('feedback', 'no-topics');
return;
}
// Setup the topic
bbp_the_topic();
?>
<h3><?php
bbp_topic_title();
?>
</h3>
<?php
// Topic edit
//.........这里部分代码省略.........
示例4: get_views
protected function get_views()
{
global $post;
$views = array();
if (bbp_is_forum_category() && bbp_has_forums()) {
$views['all'] = '<a class="current bbp-forum-title" href="' . bbp_get_forum_permalink() . '">' . __('All', 'bbpresskr') . '</a>';
while (bbp_forums()) {
bbp_the_forum();
$views[] = '<a class="bbp-forum-title" href="' . bbp_get_forum_permalink() . '">' . bbp_get_forum_title() . '</a>';
}
} else {
$forum_id = bbp_get_forum_id();
$forum = get_post($forum_id);
if ($forum->post_parent && bbp_has_forums(array('post_parent' => $forum->post_parent))) {
$views['all'] = '<a class="bbp-forum-title" href="' . bbp_get_forum_permalink($forum->post_parent) . '">' . __('All', 'bbpresskr') . '</a>';
while (bbp_forums()) {
bbp_the_forum();
$current = $forum_id == $post->ID ? ' current' : '';
$views[$post->post_name] = '<a class="bbp-forum-title' . $current . '" href="' . bbp_get_forum_permalink() . '">' . bbp_get_forum_title() . '</a>';
}
}
}
return $views;
}