本文整理汇总了PHP中bbp_set_query_name函数的典型用法代码示例。如果您正苦于以下问题:PHP bbp_set_query_name函数的具体用法?PHP bbp_set_query_name怎么用?PHP bbp_set_query_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bbp_set_query_name函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: do_action
<?php
}
?>
<?php
do_action('bbp_after_statistics');
?>
</dl>
<?php
do_action('bbp_before_popular_topics');
?>
<?php
bbp_set_query_name('bbp_popular_topics');
?>
<?php
if (bbp_has_topics(array('meta_key' => '_bbp_reply_count', 'posts_per_page' => 15, 'max_num_pages' => 1, 'orderby' => 'meta_value_num', 'show_stickies' => false))) {
?>
<h2 class="entry-title"><?php
_e('Popular Topics', 'bbpress');
?>
</h2>
<?php
bbp_get_template_part('bbpress/pagination', 'topics');
?>
示例2: bbp_breadcrumb
/**
* Single View Content Part
*
* @package bbPress
* @subpackage Theme
*/
?>
<div id="bbpress-forums">
<?php
bbp_breadcrumb();
?>
<?php
bbp_set_query_name(bbp_get_view_rewrite_id());
?>
<?php
if (bbp_view_query()) {
?>
<?php
bbp_get_template_part('pagination', 'topics');
?>
<?php
bbp_get_template_part('loop', 'topics');
?>
<?php
示例3: bbp_breadcrumb
/**
* Search Content Part
*
* @package bbPress
* @subpackage Theme
*/
?>
<div id="bbpress-forums">
<?php
bbp_breadcrumb();
?>
<?php
bbp_set_query_name(bbp_get_search_rewrite_id());
?>
<?php
do_action('bbp_template_before_search');
?>
<?php
if (bbp_has_search_results()) {
?>
<?php
//bbp_get_template_part( 'pagination', 'search' );
?>
<?php
示例4: bbp_breadcrumb
/**
* Search Content Part
*
* @package bbPress
* @subpackage Theme
*/
?>
<div id="bbpress-forums">
<?php
bbp_breadcrumb();
?>
<?php
bbp_set_query_name('bbp_search');
?>
<?php
do_action('bbp_template_before_search');
?>
<?php
if (bbp_has_search_results()) {
?>
<?php
bbp_get_template_part('loop', 'search');
?>
示例5: bbp_set_query_name
*
* @package bbPress
* @subpackage Theme
*/
?>
<?php
if (bbp_is_subscriptions_active()) {
?>
<?php
if (bbp_is_user_home() || current_user_can('edit_users')) {
?>
<?php
bbp_set_query_name('bbp_user_profile_subscriptions');
?>
<div id="bbp-author-subscriptions" class="bbp-author-subscriptions">
<hr />
<h2 class="entry-title"><?php
_e('Subscribed Forum Topics', 'bbpress');
?>
</h2>
<div class="entry-content">
<?php
if (bbp_get_user_subscriptions()) {
bbp_get_template_part('bbpress/pagination', 'topics');
bbp_get_template_part('bbpress/loop', 'topics');
bbp_get_template_part('bbpress/pagination', 'topics');
示例6: bbp_reset_query_name
/**
* Used to clear the '_bbp_query_name' setting
*
* @since bbPress (r2692)
*
* @uses bbp_set_query_name() To set the query var '_bbp_query_name' value to ''
*/
function bbp_reset_query_name()
{
bbp_set_query_name();
}
示例7: bbp_breadcrumb
<?php
/**
* Single View Content Part
*
* @package bbPress
* @subpackage Theme
*/
?>
<?php
bbp_breadcrumb();
?>
<?php
bbp_set_query_name('bbp_view');
?>
<?php
if (bbp_view_query()) {
?>
<?php
bbp_get_template_part('bbpress/pagination', 'topics');
?>
<?php
bbp_get_template_part('bbpress/loop', 'topics');
?>
<?php
示例8: bbp_set_query_name
<?php
/**
* User Favorites
*
* @package bbPress
* @subpackage Theme
*/
?>
<?php
bbp_set_query_name('bbp_user_profile_favorites');
?>
<div id="bbp-author-favorites" class="bbp-author-favorites">
<hr />
<h2 class="entry-title"><?php
_e('Favorite Forum Topics', 'bbpress');
?>
</h2>
<div class="entry-content">
<?php
if (bbp_get_user_favorites()) {
bbp_get_template_part('bbpress/pagination', 'topics');
bbp_get_template_part('bbpress/loop', 'topics');
bbp_get_template_part('bbpress/pagination', 'topics');
} else {
?>
<p><?php
示例9: 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
//.........这里部分代码省略.........
示例10: the_content
?>
</h1>
<div class="entry-content">
<?php
the_content();
?>
<div id="bbpress-forums">
<?php
bbp_breadcrumb();
?>
<?php
bbp_set_query_name('bbp_no_replies');
?>
<?php
if (bbp_has_topics(array('meta_key' => '_bbp_reply_count', 'meta_value' => '1', 'meta_compare' => '<', 'orderby' => 'date', 'show_stickies' => false))) {
?>
<?php
bbp_get_template_part('pagination', 'topics');
?>
<?php
bbp_get_template_part('loop', 'topics');
?>
<?php
示例11: do_action
<?php
/**
* User Topics Created
*
* @package bbPress
* @subpackage Theme
*/
?>
<?php
do_action('bbp_template_before_user_topics_created');
?>
<?php
bbp_set_query_name('bbp_user_profile_topics_created');
?>
<div id="bbp-author-topics-started" class="bbp-author-topics-started">
<h2 class="entry-title"><?php
_e('Forum Topics Created', 'bbpress');
?>
</h2>
<div class="bbp-user-section">
<?php
if (bbp_get_user_topics_started()) {
?>
<?php
bbp_get_template_part('pagination', 'topics');
示例12: start
/**
* Start an output buffer.
*
* This is used to put the contents of the shortcode into a variable rather
* than outputting the HTML at run-time. This allows shortcodes to appear
* in the correct location in the_content() instead of when it's created.
*
* @since bbPress (r3079)
*
* @param string $query_name
*
* @uses bbp_set_query_name()
* @uses ob_start()
*/
private function start($query_name = '')
{
// Set query name
bbp_set_query_name($query_name);
// Remove 'bbp_replace_the_content' filter to prevent infinite loops
remove_filter('the_content', 'bbp_replace_the_content');
// Start output buffer
ob_start();
}
示例13: start
/**
* Start an output buffer.
*
* This is used to put the contents of the shortcode into a variable rather
* than outputting the HTML at run-time. This allows shortcodes to appear
* in the correct location in the_content() instead of when it's created.
*
* @since bbPress (r3079)
*
* @param string $query_name
*
* @uses bbp_set_query_name()
* @uses ob_start()
*/
private function start($query_name = '')
{
// Set query name
bbp_set_query_name($query_name);
// Start output buffer
ob_start();
}
示例14: 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
//.........这里部分代码省略.........
示例15: 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)
{
// Allow actions immediately before group forum output
do_action('bbp_before_group_forum_display');
// Load up bbPress once
$bbp = bbpress();
// Forum data
$forum_slug = bp_action_variable($offset);
$forum_ids = bbp_get_group_forum_ids(bp_get_current_group_id());
$forum_args = array('post__in' => $forum_ids, 'post_parent' => null);
// Unset global queries
$bbp->forum_query = new stdClass();
$bbp->topic_query = new stdClass();
$bbp->reply_query = new stdClass();
// Unset global ID's
$bbp->current_forum_id = 0;
$bbp->current_topic_id = 0;
$bbp->current_reply_id = 0;
$bbp->current_topic_tag_id = 0;
// Reset the post data
wp_reset_postdata();
// Allow admins special views
$post_status = array(bbp_get_closed_status_id(), bbp_get_public_status_id());
if (is_super_admin() || current_user_can('moderate') || bp_is_item_admin() || bp_is_item_mod()) {
$post_status = array_merge($post_status, array(bbp_get_spam_status_id(), bbp_get_trash_status_id()));
}
?>
<div id="bbpress-forums">
<?php
// Looking at the group forum root
if (empty($forum_slug) || 'page' == $forum_slug) {
// Query forums and show them if they exist
if (!empty($forum_ids) && bbp_has_forums($forum_args)) {
// Only one forum found
if (1 == $bbp->forum_query->post_count) {
// Remove 'name' check for paginated requests
if ('page' == $forum_slug) {
$forum_args = array('post_type' => bbp_get_forum_post_type());
} else {
$forum_args = array('name' => $forum_slug, 'post_type' => bbp_get_forum_post_type());
}
// Get the forums
$forums = get_posts($forum_args);
bbp_the_forum();
// Forum exists
if (!empty($forums)) {
$forum = $forums[0];
// Suppress subforums for now
add_filter('bbp_get_forum_subforum_count', '__return_false');
// Set up forum data
bbpress()->current_forum_id = $forum->ID;
bbp_set_query_name('bbp_single_forum');
?>
<h3><?php
bbp_forum_title();
?>
</h3>
<?php
bbp_get_template_part('content', 'single-forum');
?>
<?php
// Remove the subforum suppression filter
remove_filter('bbp_get_forum_subforum_count', '__return_false');
?>
<?php
} else {
?>
<?php
bbp_get_template_part('feedback', 'no-topics');
?>
<?php
bbp_get_template_part('form', 'topic');
?>
<?php
}
// More than 1 forum found or group forum admin screen
} elseif (1 < $bbp->forum_query->post_count) {
?>
<h3><?php
_e('Forums', 'bbpress');
?>
//.........这里部分代码省略.........