本文整理汇总了PHP中bbp_has_forums函数的典型用法代码示例。如果您正苦于以下问题:PHP bbp_has_forums函数的具体用法?PHP bbp_has_forums怎么用?PHP bbp_has_forums使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bbp_has_forums函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bbp_forum_subscription_link
</div>
<?php
}
?>
<?php
bbp_forum_subscription_link();
?>
<?php
do_action('bbp_template_before_forums_index');
?>
<?php
if (bbp_has_forums()) {
?>
<?php
bbp_get_template_part('loop', 'forums');
?>
<?php
} else {
?>
<?php
bbp_get_template_part('feedback', 'no-forums');
?>
<?php
示例2: crystalskull_my_scripts
function crystalskull_my_scripts()
{
wp_register_script('bootstrap1', get_template_directory_uri() . '/js/bootstrap.min.js', '', '', true);
wp_enqueue_script('bootstrap1');
if (of_get_option('appear') == 1) {
wp_register_script('custom_js2', get_template_directory_uri() . '/js/appear-img.js', '', '', true);
wp_enqueue_script('custom_js2');
}
if (function_exists('bbp_has_forums')) {
if (bbp_has_forums()) {
wp_register_script('bbpress_title_fix', get_template_directory_uri() . '/js/bbpress_title_fix.js', '', '', true);
wp_enqueue_script('bbpress_title_fix');
}
}
wp_register_script('fancybox', get_template_directory_uri() . '/js/jquery.fancybox.js', '', '', true);
wp_enqueue_script('fancybox');
wp_register_script('custom_js3', get_template_directory_uri() . '/js/jquery-ui-1.10.3.custom.min.js', '', '', true);
wp_enqueue_script('custom_js3');
wp_register_script('custom_js4', get_template_directory_uri() . '/js/jquery.carouFredSel-6.2.1-packed.js', '', '', true);
wp_enqueue_script('custom_js4');
wp_register_script('custom_js7', get_template_directory_uri() . '/js/jquery.webticker.js', '', '', true);
wp_enqueue_script('custom_js7');
wp_register_script('custom_js9', get_template_directory_uri() . '/js/isotope.js', '', '', true);
wp_enqueue_script('custom_js9');
wp_register_script('custom_js10', get_template_directory_uri() . '/js/imagesloaded.min.js', '', '', true);
wp_enqueue_script('custom_js10');
wp_register_script('custom_js11', get_template_directory_uri() . '/js/jquery.validate.min.js', '', '', true);
wp_enqueue_script('custom_js11');
wp_register_script('custom_js12', get_template_directory_uri() . '/js/ps.js', '', '', true);
wp_enqueue_script('custom_js12');
wp_register_script('custom_js13', get_template_directory_uri() . '/js/jquery.clickoutside.js', '', '', true);
wp_enqueue_script('custom_js13');
wp_register_script('custom_js14', get_template_directory_uri() . '/js/inview.js', '', '', true);
wp_enqueue_script('custom_js14');
wp_register_script('custom_js99', get_template_directory_uri() . '/js/global.js', array('fancybox', 'jquery'), '', true);
wp_enqueue_script('custom_js99');
wp_enqueue_script('owl-carousel', get_template_directory_uri() . '/addons/wp-owl-carousel/owl-carousel/owl.carousel.min.js', array('jquery'), '', true);
wp_enqueue_script('wp-owl-carousel', get_template_directory_uri() . '/addons/wp-owl-carousel/js/wp-owl-carousel.js', array('owl-carousel'), '', true);
}
示例3: bbp_forum_content
<?php
} else {
?>
<?php
//bbp_single_forum_description();
?>
<div class="bbp-forum-content panel panel-default"><div class="panel-body"><?php
bbp_forum_content();
?>
</div></div>
<?php
if (bbp_get_forum_subforum_count() && bbp_has_forums()) {
?>
<?php
bbp_get_template_part('loop', 'forums');
?>
<?php
}
?>
<?php
if (!bbp_is_forum_category() && bbp_has_topics()) {
?>
<?php
示例4: bbp_get_user_forum_subscriptions
/**
* Get a user's subscribed forums
*
* @since bbPress (r5156)
*
* @param int $user_id Optional. User id
* @uses bbp_get_user_subscribed_forum_ids() To get the user's subscriptions
* @uses bbp_has_forums() To get the forums
* @uses apply_filters() Calls 'bbp_get_user_forum_subscriptions' with the forum
* query and user id
* @return array|bool Results if user has subscriptions, otherwise false
*/
function bbp_get_user_forum_subscriptions($user_id = 0)
{
// Default to the displayed user
$user_id = bbp_get_user_id($user_id);
if (empty($user_id)) {
return false;
}
// If user has subscriptions, load them
$subscriptions = bbp_get_user_subscribed_forum_ids($user_id);
if (!empty($subscriptions)) {
$query = bbp_has_forums(array('post__in' => $subscriptions));
} else {
$query = false;
}
return apply_filters('bbp_get_user_forum_subscriptions', $query, $user_id);
}
示例5: bbp_show_lead_topic
/ <?php
bbp_show_lead_topic() ? _e('Replies', 'bbpress') : _e('Posts', 'bbpress');
?>
</li>
<li class="normal bbp-forum-freshness"><?php
_e('Freshness', 'bbpress');
?>
</li>
</ul>
</div>
<?php
// get sub-forums
$orig_query = clone bbpress()->forum_query;
bbp_has_forums(array('post_parent' => bbp_get_forum_id()));
while (bbp_forums()) {
bbp_the_forum();
?>
<?php
bbp_get_template_part('loop', 'single-forum');
?>
<?php
}
// restore query
bbpress()->forum_query = $orig_query;
?>
</div>
示例6: bbp_forum_subscription_link
<div id="bbpress-forums">
<?php
bbp_forum_subscription_link();
?>
<?php
do_action('bbp_template_before_forums_index');
?>
<?php
$arr_top = arreat_get_categories();
if (empty($arr_top)) {
bbp_get_template_part('feedback', 'no-forums');
}
?>
<?php
foreach ($arr_top as $arr_forum) {
if (bbp_has_forums(['post_parent' => $arr_forum->ID])) {
include 'loop-forums.php';
}
}
?>
<?php
do_action('bbp_template_after_forums_index');
?>
</div>
示例7: 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
//.........这里部分代码省略.........
示例8: _e
</div>
<div
class="topics_list_divider"><?php
_e('Недавние обсуждения', 'qode');
?>
</div>
<div class="topics_list" data-list="2" data-forum="<?php
echo $forum_id;
?>
">
<?php
$isForumModerator = bbp_get_user_role(get_current_user_id()) != 'bbp_moderator' && bbp_get_user_role(get_current_user_id()) != 'bbp_keymaster';
if (bbp_has_forums($buddypress_id)) {
$topics = false;
while (bbp_forums()) {
bbp_the_forum();
if ($forum_id != bbp_get_forum_id()) {
continue;
}
$topics = bbp_has_topics(array('post_parent' => $forum_id, 'posts_per_page' => 11));
if (!$topics) {
_e('This forum does not have topics', 'qode');
break;
}
$counter = 0;
if (bp_group_is_visible($group)) {
global $post;
$post = bbp_get_forum($forum_id);
示例9: bbp_forum_subscription_link
<div id="bbpress-forums">
<?php bbp_forum_subscription_link(); ?>
<?php do_action( 'bbp_template_before_single_forum' ); ?>
<?php if ( post_password_required() ) : ?>
<?php bbp_get_template_part( 'form', 'protected' ); ?>
<?php else : ?>
<?php bbp_single_forum_description(); ?>
<?php if ( bbp_has_forums() ) : ?>
<?php bbp_get_template_part( 'loop', 'forums' ); ?>
<?php endif; ?>
<?php if ( !bbp_is_forum_category() && bbp_has_topics() ) : ?>
<?php bbp_get_template_part( 'pagination', 'topics' ); ?>
<?php bbp_get_template_part( 'loop', 'topics' ); ?>
<?php bbp_get_template_part( 'pagination', 'topics' ); ?>
<?php bbp_get_template_part( 'form', 'topic' ); ?>
示例10: test_bbp_get_user_forum_subscriptions
/**
* @covers ::bbp_get_user_forum_subscriptions
*/
public function test_bbp_get_user_forum_subscriptions()
{
$u = $this->factory->user->create();
$f = $this->factory->forum->create_many(3);
// Add forum subscriptions.
bbp_add_user_forum_subscription($u, $f[0]);
bbp_add_user_forum_subscription($u, $f[1]);
bbp_add_user_forum_subscription($u, $f[2]);
$expected = bbp_has_forums(array('post__in' => array($f[0], $f[1], $f[2])));
$subscriptions = bbp_get_user_forum_subscriptions($u);
$this->assertEquals($expected, $subscriptions);
// Remove forum subscription.
bbp_remove_user_forum_subscription($u, $f[1]);
$expected = bbp_has_forums(array('post__in' => array($f[0], $f[2])));
$subscriptions = bbp_get_user_forum_subscriptions($u);
$this->assertEquals($expected, $subscriptions);
}
示例11: 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;
}
示例12: elseif
<?php
/**
* Apocrypha Theme Single Forum Contents
* Andrew Clayton
* Version 2.0
* 7-23-2014
*/
?>
<?php
// Top-level categories
if (bbp_is_forum_category() && bbp_has_forums()) {
?>
<?php
bbp_get_template_part('loop', 'single-forum');
?>
<?php
// Single sub-forum
} elseif (!bbp_is_forum_category()) {
?>
<?php
// Topics found
if (bbp_has_topics()) {
?>
<?php
bbp_get_template_part('loop', 'topics');
?>
<?php
示例13: display_forums
/**
* Output the forums for a group in the edit screens
*
* @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 $wpdb;
$bbp = bbpress();
// Forum data
$forum_ids = bbp_get_group_forum_ids(bp_get_current_group_id());
$forum_args = array('post__in' => $forum_ids, 'post_parent' => null);
?>
<div id="bbpress-forums">
<?php
// Looking at the group forum root
if (!bp_action_variable($offset)) {
// Query forums and show them if
if (!empty($forum_ids) && bbp_has_forums($forum_args)) {
bbp_the_forum();
// Only one forum found
if ($bbp->forum_query->post_count == 1) {
?>
<h3><?php
_e('Forum', 'bbpress');
?>
</h3>
<?php
bbp_set_query_name('bbp_single_forum');
?>
<?php
if (bbp_has_topics(array('post_parent' => bbp_get_forum_id()))) {
?>
<?php
bbp_get_template_part('pagination', 'topics');
?>
<?php
bbp_get_template_part('loop', 'topics');
?>
<?php
bbp_get_template_part('pagination', 'topics');
?>
<?php
bbp_get_template_part('form', 'topic');
?>
<?php
} else {
?>
<?php
bbp_get_template_part('feedback', 'no-topics');
?>
<?php
bbp_get_template_part('form', 'topic');
?>
<?php
}
// More than 1 forum found
} elseif ($bbp->forum_query->post_count > 1) {
?>
<h3><?php
_e('Forums', 'bbpress');
?>
</h3>
<?php
bbp_get_template_part('loop', 'forums');
?>
<h3><?php
_e('Topics', 'bbpress');
?>
</h3>
<?php
if (bbp_has_topics(array('post_parent__in' => $forum_ids))) {
?>
<?php
bbp_get_template_part('pagination', 'topics');
?>
<?php
//.........这里部分代码省略.........
示例14: bbpress
?>
</li>
</ul>
</li><!-- .bbp-header -->
<?php
}
?>
<li class="bbp-body">
<?php
/* If the forum is a category, we're gonna make another loop to show its subforums and sub-subforums as if those were forums */
if (bbp_is_forum_category()) {
$temp_query = clone bbpress()->forum_query;
bbp_has_forums('post_parent=' . bbp_get_forum_id());
while (bbp_forums()) {
bbp_the_forum();
bbp_get_template_part('loop', 'single-forum');
}
bbpress()->forum_query = clone $temp_query;
} else {
bbp_get_template_part('loop', 'single-forum');
$bbp_forums_noheader = 1;
/* This prevents the header part to be printed again on next post in the loop */
}
?>
</li><!-- .bbp-body -->
<?php
示例15: display_topic_option
/**
* Add the bbPress topic option to the Discussion meta box
*/
function display_topic_option($post)
{
/** Store the post being edited and restore it after looping over forums */
global $post;
$the_post = $post;
if (!function_exists('bbp_has_forums')) {
?>
<br /><p><?php
_e('bbPress Topics for Posts has been enabled, but cannot detect your bbPress setup.', 'bbpress-post-topics');
?>
</p><?php
return;
}
$bbpress_topic_options = $this->get_topic_options_for_post($post->ID);
$bbpress_topic_status = $bbpress_topic_options['enabled'] != false;
$bbpress_topic_display = $bbpress_topic_options['display'];
$bbpress_topic_slug = $bbpress_topic_options['topic_id'];
if ($bbpress_topic_slug) {
$bbpress_topic = bbp_get_topic($bbpress_topic_slug);
$bbpress_topic_slug = $bbpress_topic->post_name;
/** If a topic already exists, don't select default forum */
$bbpress_topic_options['forum_id'] = 0;
}
$forums = bbp_has_forums();
if (!$forums) {
?>
<br /><p><?php
_e('bbPress Topics for Posts has been enabled, but you have not created any forums yet.', 'bbpress-post-topics');
?>
</p><?php
return;
}
?>
<br />
<input type="hidden" name="bbpress_topic[form_displayed]" value="true" />
<label for="bbpress_topic_status" class="selectit"><input name="bbpress_topic[enabled]" type="checkbox" id="bbpress_topic_status" value="open" <?php
checked($bbpress_topic_status);
?>
/> <?php
_e('Use a bbPress forum topic for comments on this post.', 'bbpress-post-topics');
?>
</label><br />
<div id="bbpress_topic_status_options" class="inside" style="display: <?php
echo checked($bbpress_topic_status, true, false) ? 'block' : 'none';
?>
;">
<h4>bbPress Topic Options</h4>
<label for="bbpress_topic_slug"><?php
_e('Use an existing topic:', 'bbpress-post-topics');
?>
</label> <input type="text" name="bbpress_topic[slug]" id="bbpress_topic_slug" placeholder="<?php
_e('Topic ID or slug', 'bbpress-post-topics');
?>
" value="<?php
echo $bbpress_topic_slug;
?>
" <?php
if ($bbpress_topic_options['forum_id']) {
echo ' disabled="true"';
}
?>
/>
- OR - <label for="bbpress_topic_forum"><?php
_e('Create a new topic in forum:', 'bbpress-post-topics');
?>
</label>
<select name="bbpress_topic[forum_id]" id="bbpress_topic_forum">
<option value="0" selected><?php
_e('Select a Forum', 'bbpress-post-topics');
?>
</option>
<?php
$forum_dropdown_options = array('selected' => $bbpress_topic_options['forum_id'], 'options_only' => true);
bbp_dropdown($forum_dropdown_options);
?>
</select><br />
— <input type="checkbox" name="bbpress_topic[copy_tags]" id="bbpress_topic_copy_tags" <?php
checked($bbpress_topic_options['copy_tags'], 'on');
?>
/> <label for="bbpress_topic_copy_tags"><?php
_e('Copy post tags to new topic', 'bbpress-post-topics');
?>
</label>
<?php
if ($import_date = get_post_meta($post->ID, 'bbpress_discussion_tags_copied', true)) {
printf('( ' . __('last copied %s ago', 'bbpress-post-topics') . ' )', human_time_diff($import_date));
}
?>
<br />
<?php
if (wp_count_comments($post->ID)->total_comments > 0) {
?>
— <input type="checkbox" name="bbpress_topic[copy_comments]" id="bbpress_topic_copy_comments" <?php
checked($bbpress_topic_options['copy_comments'], 'on');
?>
//.........这里部分代码省略.........