本文整理汇总了PHP中bbp_get_topic_tag_name函数的典型用法代码示例。如果您正苦于以下问题:PHP bbp_get_topic_tag_name函数的具体用法?PHP bbp_get_topic_tag_name怎么用?PHP bbp_get_topic_tag_name使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bbp_get_topic_tag_name函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bbp_topic_tag_name
/**
* Output the name of the current tag
*
* @since 2.0.0 bbPress (r3109)
*
* @uses bbp_get_topic_tag_name()
*/
function bbp_topic_tag_name($tag = '')
{
echo bbp_get_topic_tag_name($tag);
}
示例2: do_trail_items
/**
* Runs through the various bbPress conditional tags to check the current page being viewed. Once
* a condition is met, add items to the $items array.
*
* @since 0.6.0
* @access public
* @return void
*/
public function do_trail_items()
{
/* Add the network and site home links. */
$this->do_network_home_link();
$this->do_site_home_link();
/* Get the forum post type object. */
$post_type_object = get_post_type_object(bbp_get_forum_post_type());
/* If not viewing the forum root/archive page and a forum archive exists, add it. */
if (!empty($post_type_object->has_archive) && !bbp_is_forum_archive()) {
$this->items[] = '<a href="' . get_post_type_archive_link(bbp_get_forum_post_type()) . '">' . bbp_get_forum_archive_title() . '</a>';
}
/* If viewing the forum root/archive. */
if (bbp_is_forum_archive()) {
if (true === $this->args['show_title']) {
$this->items[] = bbp_get_forum_archive_title();
}
} elseif (bbp_is_topic_archive()) {
if (true === $this->args['show_title']) {
$this->items[] = bbp_get_topic_archive_title();
}
} elseif (bbp_is_topic_tag()) {
if (true === $this->args['show_title']) {
$this->items[] = bbp_get_topic_tag_name();
}
} elseif (bbp_is_topic_tag_edit()) {
$this->items[] = '<a href="' . bbp_get_topic_tag_link() . '">' . bbp_get_topic_tag_name() . '</a>';
if (true === $this->args['show_title']) {
$this->items[] = __('Edit', 'breadcrumb-trail');
}
} elseif (bbp_is_single_view()) {
if (true === $this->args['show_title']) {
$this->items[] = bbp_get_view_title();
}
} elseif (bbp_is_single_topic()) {
/* Get the queried topic. */
$topic_id = get_queried_object_id();
/* Get the parent items for the topic, which would be its forum (and possibly forum grandparents). */
$this->do_post_parents(bbp_get_topic_forum_id($topic_id));
/* If viewing a split, merge, or edit topic page, show the link back to the topic. Else, display topic title. */
if (bbp_is_topic_split() || bbp_is_topic_merge() || bbp_is_topic_edit()) {
$this->items[] = '<a href="' . bbp_get_topic_permalink($topic_id) . '">' . bbp_get_topic_title($topic_id) . '</a>';
} elseif (true === $this->args['show_title']) {
$this->items[] = bbp_get_topic_title($topic_id);
}
/* If viewing a topic split page. */
if (bbp_is_topic_split() && true === $this->args['show_title']) {
$this->items[] = __('Split', 'breadcrumb-trail');
} elseif (bbp_is_topic_merge() && true === $this->args['show_title']) {
$this->items[] = __('Merge', 'breadcrumb-trail');
} elseif (bbp_is_topic_edit() && true === $this->args['show_title']) {
$this->items[] = __('Edit', 'breadcrumb-trail');
}
} elseif (bbp_is_single_reply()) {
/* Get the queried reply object ID. */
$reply_id = get_queried_object_id();
/* Get the parent items for the reply, which should be its topic. */
$this->do_post_parents(bbp_get_reply_topic_id($reply_id));
/* If viewing a reply edit page, link back to the reply. Else, display the reply title. */
if (bbp_is_reply_edit()) {
$this->items[] = '<a href="' . bbp_get_reply_url($reply_id) . '">' . bbp_get_reply_title($reply_id) . '</a>';
if (true === $this->args['show_title']) {
$this->items[] = __('Edit', 'breadcrumb-trail');
}
} elseif (true === $this->args['show_title']) {
$this->items[] = bbp_get_reply_title($reply_id);
}
} elseif (bbp_is_single_forum()) {
/* Get the queried forum ID and its parent forum ID. */
$forum_id = get_queried_object_id();
$forum_parent_id = bbp_get_forum_parent_id($forum_id);
/* If the forum has a parent forum, get its parent(s). */
if (0 !== $forum_parent_id) {
$this->do_post_parents($forum_parent_id);
}
/* Add the forum title to the end of the trail. */
if (true === $this->args['show_title']) {
$this->items[] = bbp_get_forum_title($forum_id);
}
} elseif (bbp_is_single_user() || bbp_is_single_user_edit()) {
if (bbp_is_single_user_edit()) {
$this->items[] = '<a href="' . bbp_get_user_profile_url() . '">' . bbp_get_displayed_user_field('display_name') . '</a>';
if (true === $this->args['show_title']) {
$this->items[] = __('Edit', 'breadcrumb-trail');
}
} elseif (true === $this->args['show_title']) {
$this->items[] = bbp_get_displayed_user_field('display_name');
}
}
/* Return the bbPress breadcrumb trail items. */
$this->items = apply_filters('breadcrumb_trail_get_bbpress_items', $this->items, $this->args);
}
示例3: bbp_get_breadcrumb
/**
* Return a breadcrumb ( forum -> topic -> reply )
*
* @since bbPress (r2589)
*
* @param string $sep Separator. Defaults to '←'
* @param bool $current_page Include the current item
* @param bool $root Include the root page if one exists
*
* @uses get_post() To get the post
* @uses bbp_get_forum_permalink() To get the forum link
* @uses bbp_get_topic_permalink() To get the topic link
* @uses bbp_get_reply_permalink() To get the reply link
* @uses get_permalink() To get the permalink
* @uses bbp_get_forum_post_type() To get the forum post type
* @uses bbp_get_topic_post_type() To get the topic post type
* @uses bbp_get_reply_post_type() To get the reply post type
* @uses bbp_get_forum_title() To get the forum title
* @uses bbp_get_topic_title() To get the topic title
* @uses bbp_get_reply_title() To get the reply title
* @uses get_the_title() To get the title
* @uses apply_filters() Calls 'bbp_get_breadcrumb' with the crumbs
* @return string Breadcrumbs
*/
function bbp_get_breadcrumb($args = array())
{
// Turn off breadcrumbs
if (apply_filters('bbp_no_breadcrumb', is_front_page())) {
return;
}
// Define variables
$front_id = $root_id = 0;
$ancestors = $crumbs = $tag_data = array();
$pre_root_text = $pre_front_text = $pre_current_text = '';
$pre_include_root = $pre_include_home = $pre_include_current = true;
/** Home Text *********************************************************/
// No custom home text
if (empty($args['home_text'])) {
// Set home text to page title
$front_id = get_option('page_on_front');
if (!empty($front_id)) {
$pre_front_text = get_the_title($front_id);
// Default to 'Home'
} else {
$pre_front_text = __('Home', 'bbpress');
}
}
/** Root Text *********************************************************/
// No custom root text
if (empty($args['root_text'])) {
$page = bbp_get_page_by_path(bbp_get_root_slug());
if (!empty($page)) {
$root_id = $page->ID;
}
$pre_root_text = bbp_get_forum_archive_title();
}
/** Includes **********************************************************/
// Root slug is also the front page
if (!empty($front_id) && $front_id == $root_id) {
$pre_include_root = false;
}
// Don't show root if viewing forum archive
if (bbp_is_forum_archive()) {
$pre_include_root = false;
}
// Don't show root if viewing page in place of forum archive
if (!empty($root_id) && ((is_single() || is_page()) && $root_id == get_the_ID())) {
$pre_include_root = false;
}
/** Current Text ******************************************************/
// Forum archive
if (bbp_is_forum_archive()) {
$pre_current_text = bbp_get_forum_archive_title();
// Topic archive
} elseif (bbp_is_topic_archive()) {
$pre_current_text = bbp_get_topic_archive_title();
// View
} elseif (bbp_is_single_view()) {
$pre_current_text = bbp_get_view_title();
// Single Forum
} elseif (bbp_is_single_forum()) {
$pre_current_text = bbp_get_forum_title();
// Single Topic
} elseif (bbp_is_single_topic()) {
$pre_current_text = bbp_get_topic_title();
// Single Topic
} elseif (bbp_is_single_reply()) {
$pre_current_text = bbp_get_reply_title();
// Topic Tag (or theme compat topic tag)
} elseif (bbp_is_topic_tag() || get_query_var('bbp_topic_tag') && !bbp_is_topic_tag_edit()) {
// Always include the tag name
$tag_data[] = bbp_get_topic_tag_name();
// If capable, include a link to edit the tag
if (current_user_can('manage_topic_tags')) {
$tag_data[] = '<a href="' . bbp_get_topic_tag_edit_link() . '" class="bbp-edit-topic-tag-link">' . __('(Edit)', 'bbpress') . '</a>';
}
// Implode the results of the tag data
$pre_current_text = sprintf(__('Topic Tag: %s', 'bbpress'), implode(' ', $tag_data));
// Edit Topic Tag
} elseif (bbp_is_topic_tag_edit()) {
//.........这里部分代码省略.........
示例4: _e
_e('Deleting a tag cannot be undone. This does not delete your topics. Only the tag itself is deleted. Any links to this tag will no longer function.', '__x__');
?>
</p>
</div>
<form id="delete_tag" name="delete_tag" method="post" action="<?php
the_permalink();
?>
">
<div class="bbp-submit-wrapper">
<button type="submit" tabindex="<?php
bbp_tab_index();
?>
" class="button submit" onclick="return confirm('<?php
echo esc_js(sprintf(__('Are you sure you want to delete the "%s" tag? This is permanent and cannot be undone.', 'bbpress'), bbp_get_topic_tag_name()));
?>
');"><?php
esc_attr_e('Delete', 'bbpress');
?>
</button>
<input type="hidden" name="tag-id" value="<?php
bbp_topic_tag_id();
?>
" />
<input type="hidden" name="action" value="bbp-delete-topic-tag" />
<?php
wp_nonce_field('delete-tag_' . bbp_get_topic_tag_id());
?>
示例5: bbp_title
/**
* Custom page title for bbPress pages
*
* @since bbPress (r2788)
*
* @param string $title Optional. The title (not used).
* @param string $sep Optional, default is '»'. How to separate the
* various items within the page title.
* @param string $seplocation Optional. Direction to display title, 'right'.
* @uses bbp_is_single_user() To check if it's a user profile page
* @uses bbp_is_single_user_edit() To check if it's a user profile edit page
* @uses bbp_is_user_home() To check if the profile page is of the current user
* @uses get_query_var() To get the user id
* @uses get_userdata() To get the user data
* @uses bbp_is_single_forum() To check if it's a forum
* @uses bbp_get_forum_title() To get the forum title
* @uses bbp_is_single_topic() To check if it's a topic
* @uses bbp_get_topic_title() To get the topic title
* @uses bbp_is_single_reply() To check if it's a reply
* @uses bbp_get_reply_title() To get the reply title
* @uses is_tax() To check if it's the tag page
* @uses get_queried_object() To get the queried object
* @uses bbp_is_single_view() To check if it's a view
* @uses bbp_get_view_title() To get the view title
* @uses apply_filters() Calls 'bbp_raw_title' with the title
* @uses apply_filters() Calls 'bbp_profile_page_wp_title' with the title,
* separator and separator location
* @return string The tite
*/
function bbp_title($title = '', $sep = '»', $seplocation = '')
{
// Title array
$new_title = array();
/** Archives **************************************************************/
// Forum Archive
if (bbp_is_forum_archive()) {
$new_title['text'] = bbp_get_forum_archive_title();
// Topic Archive
} elseif (bbp_is_topic_archive()) {
$new_title['text'] = bbp_get_topic_archive_title();
/** Edit ******************************************************************/
// Forum edit page
} elseif (bbp_is_forum_edit()) {
$new_title['text'] = bbp_get_forum_title();
$new_title['format'] = esc_attr__('Forum Edit: %s', 'bbpress');
// Topic edit page
} elseif (bbp_is_topic_edit()) {
$new_title['text'] = bbp_get_topic_title();
$new_title['format'] = esc_attr__('Topic Edit: %s', 'bbpress');
// Reply edit page
} elseif (bbp_is_reply_edit()) {
$new_title['text'] = bbp_get_reply_title();
$new_title['format'] = esc_attr__('Reply Edit: %s', 'bbpress');
// Topic tag edit page
} elseif (bbp_is_topic_tag_edit()) {
$new_title['text'] = bbp_get_topic_tag_name();
$new_title['format'] = esc_attr__('Topic Tag Edit: %s', 'bbpress');
/** Singles ***************************************************************/
// Forum page
} elseif (bbp_is_single_forum()) {
$new_title['text'] = bbp_get_forum_title();
$new_title['format'] = esc_attr__('Forum: %s', 'bbpress');
// Topic page
} elseif (bbp_is_single_topic()) {
$new_title['text'] = bbp_get_topic_title();
$new_title['format'] = esc_attr__('Topic: %s', 'bbpress');
// Replies
} elseif (bbp_is_single_reply()) {
$new_title['text'] = bbp_get_reply_title();
// Topic tag page
} elseif (bbp_is_topic_tag() || get_query_var('bbp_topic_tag')) {
$new_title['text'] = bbp_get_topic_tag_name();
$new_title['format'] = esc_attr__('Topic Tag: %s', 'bbpress');
/** Users *****************************************************************/
// Profile page
} elseif (bbp_is_single_user()) {
// User is viewing their own profile
if (bbp_is_user_home()) {
$new_title['text'] = esc_attr_x('Your', 'User viewing his/her own profile', 'bbpress');
// User is viewing someone else's profile (so use their display name)
} else {
$new_title['text'] = sprintf(esc_attr_x("%s's", 'User viewing another users profile', 'bbpress'), get_userdata(bbp_get_user_id())->display_name);
}
// User topics created
if (bbp_is_single_user_topics()) {
$new_title['format'] = esc_attr__("%s Topics", 'bbpress');
// User rueplies created
} elseif (bbp_is_single_user_replies()) {
$new_title['format'] = esc_attr__("%s Replies", 'bbpress');
// User favorites
} elseif (bbp_is_favorites()) {
$new_title['format'] = esc_attr__("%s Favorites", 'bbpress');
// User subscriptions
} elseif (bbp_is_subscriptions()) {
$new_title['format'] = esc_attr__("%s Subscriptions", 'bbpress');
// User "home"
} else {
$new_title['format'] = esc_attr__("%s Profile", 'bbpress');
}
// Profile edit page
//.........这里部分代码省略.........
示例6: bbp_template_include_theme_compat
/**
* Reset main query vars and filter 'the_content' to output a bbPress
* template part as needed.
*
* @since bbPress (r3032)
* @param string $template
* @uses bbp_is_single_user() To check if page is single user
* @uses bbp_get_single_user_template() To get user template
* @uses bbp_is_single_user_edit() To check if page is single user edit
* @uses bbp_get_single_user_edit_template() To get user edit template
* @uses bbp_is_single_view() To check if page is single view
* @uses bbp_get_single_view_template() To get view template
* @uses bbp_is_forum_edit() To check if page is forum edit
* @uses bbp_get_forum_edit_template() To get forum edit template
* @uses bbp_is_topic_merge() To check if page is topic merge
* @uses bbp_get_topic_merge_template() To get topic merge template
* @uses bbp_is_topic_split() To check if page is topic split
* @uses bbp_get_topic_split_template() To get topic split template
* @uses bbp_is_topic_edit() To check if page is topic edit
* @uses bbp_get_topic_edit_template() To get topic edit template
* @uses bbp_is_reply_edit() To check if page is reply edit
* @uses bbp_get_reply_edit_template() To get reply edit template
* @uses bbp_set_theme_compat_template() To set the global theme compat template
*/
function bbp_template_include_theme_compat($template = '')
{
// Bail if the template already matches a bbPress template. This includes
// archive-* and single-* WordPress post_type matches (allowing
// themes to use the expected format) as well as all bbPress-specific
// template files for users, topics, forums, etc...
if (!empty(bbpress()->theme_compat->bbpress_template)) {
return $template;
}
/** Users *************************************************************/
if (bbp_is_single_user_edit() || bbp_is_single_user()) {
// Reset post
bbp_theme_compat_reset_post(array('ID' => 0, 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => '', 'post_title' => esc_attr(bbp_get_displayed_user_field('display_name')), 'post_status' => bbp_get_public_status_id(), 'is_archive' => false, 'comment_status' => 'closed'));
/** Forums ************************************************************/
// Forum archive
} elseif (bbp_is_forum_archive()) {
// Reset post
bbp_theme_compat_reset_post(array('ID' => 0, 'post_title' => bbp_get_forum_archive_title(), 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => bbp_get_forum_post_type(), 'post_status' => bbp_get_public_status_id(), 'is_archive' => true, 'comment_status' => 'closed'));
// Single Forum
} elseif (bbp_is_forum_edit() || bbp_is_single_forum()) {
// Reset post
bbp_theme_compat_reset_post(array('ID' => bbp_get_forum_id(), 'post_title' => bbp_get_forum_title(), 'post_author' => bbp_get_forum_author_id(), 'post_date' => 0, 'post_content' => get_post_field('post_content', bbp_get_forum_id()), 'post_type' => bbp_get_forum_post_type(), 'post_status' => bbp_get_forum_visibility(), 'is_single' => true, 'comment_status' => 'closed'));
/** Topics ************************************************************/
// Topic archive
} elseif (bbp_is_topic_archive()) {
// Reset post
bbp_theme_compat_reset_post(array('ID' => 0, 'post_title' => bbp_get_topic_archive_title(), 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => bbp_get_topic_post_type(), 'post_status' => bbp_get_public_status_id(), 'is_archive' => true, 'comment_status' => 'closed'));
// Single Topic
} elseif (bbp_is_topic_edit() || bbp_is_single_topic()) {
// Reset post
bbp_theme_compat_reset_post(array('ID' => bbp_get_topic_id(), 'post_title' => bbp_get_topic_title(), 'post_author' => bbp_get_topic_author_id(), 'post_date' => 0, 'post_content' => get_post_field('post_content', bbp_get_topic_id()), 'post_type' => bbp_get_topic_post_type(), 'post_status' => bbp_get_topic_status(), 'is_single' => true, 'comment_status' => 'closed'));
/** Replies ***********************************************************/
// Reply archive
} elseif (is_post_type_archive(bbp_get_reply_post_type())) {
// Reset post
bbp_theme_compat_reset_post(array('ID' => 0, 'post_title' => __('Replies', 'bbpress'), 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => bbp_get_reply_post_type(), 'post_status' => bbp_get_public_status_id(), 'comment_status' => 'closed'));
// Single Reply
} elseif (bbp_is_reply_edit() || bbp_is_single_reply()) {
// Reset post
bbp_theme_compat_reset_post(array('ID' => bbp_get_reply_id(), 'post_title' => bbp_get_reply_title(), 'post_author' => bbp_get_reply_author_id(), 'post_date' => 0, 'post_content' => get_post_field('post_content', bbp_get_reply_id()), 'post_type' => bbp_get_reply_post_type(), 'post_status' => bbp_get_reply_status(), 'comment_status' => 'closed'));
/** Views *************************************************************/
} elseif (bbp_is_single_view()) {
// Reset post
bbp_theme_compat_reset_post(array('ID' => 0, 'post_title' => bbp_get_view_title(), 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => '', 'post_status' => bbp_get_public_status_id(), 'comment_status' => 'closed'));
/** Topic Tags ********************************************************/
// Topic Tag Edit
} elseif (bbp_is_topic_tag_edit() || bbp_is_topic_tag()) {
// Stash the current term in a new var
set_query_var('bbp_topic_tag', get_query_var('term'));
// Reset the post with our new title
bbp_theme_compat_reset_post(array('ID' => 0, 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => '', 'post_title' => sprintf(__('Topic Tag: %s', 'bbpress'), '<span>' . bbp_get_topic_tag_name() . '</span>'), 'post_status' => bbp_get_public_status_id(), 'comment_status' => 'closed'));
}
/**
* If we are relying on bbPress's built in theme compatibility to load
* the proper content, we need to intercept the_content, replace the
* output, and display ours instead.
*
* To do this, we first remove all filters from 'the_content' and hook
* our own function into it, which runs a series of checks to determine
* the context, and then uses the built in shortcodes to output the
* correct results from inside an output buffer.
*
* Uses bbp_get_theme_compat_templates() to provide fall-backs that
* should be coded without superfluous mark-up and logic (prev/next
* navigation, comments, date/time, etc...)
*
* Hook into the 'bbp_get_bbpress_template' to override the array of
* possible templates, or 'bbp_bbpress_template' to override the result.
*/
if (bbp_is_theme_compat_active()) {
// Remove all filters from the_content
bbp_remove_all_filters('the_content');
// Add a filter on the_content late, which we will later remove
add_filter('the_content', 'bbp_replace_the_content');
// Find the appropriate template file
$template = bbp_get_theme_compat_templates();
//.........这里部分代码省略.........
示例7: get_header
* @package bbPress
* @subpackage Theme
*/
get_header();
?>
<div id="container">
<div id="content" role="main">
<?php
do_action('bbp_template_notices');
?>
<div id="topic-tag" class="bbp-topic-tag">
<h1 class="entry-title"><?php
printf(__('Topic Tag: %s', 'bbpress'), '<span>' . bbp_get_topic_tag_name() . '</span>');
?>
</h1>
<div class="entry-content">
<?php
bbp_breadcrumb();
?>
<?php
bbp_topic_tag_description();
?>
<?php
do_action('bbp_template_before_topic_tag_edit');
示例8: x_bbpress_filter_breadcrumbs
function x_bbpress_filter_breadcrumbs($r)
{
if (bbp_is_search()) {
$current_text = bbp_get_search_title();
} elseif (bbp_is_forum_archive()) {
$current_text = bbp_get_forum_archive_title();
} elseif (bbp_is_topic_archive()) {
$current_text = bbp_get_topic_archive_title();
} elseif (bbp_is_single_view()) {
$current_text = bbp_get_view_title();
} elseif (bbp_is_single_forum()) {
$current_text = bbp_get_forum_title();
} elseif (bbp_is_single_topic()) {
$current_text = bbp_get_topic_title();
} elseif (bbp_is_single_reply()) {
$current_text = bbp_get_reply_title();
} elseif (bbp_is_topic_tag() || get_query_var('bbp_topic_tag') && !bbp_is_topic_tag_edit()) {
// Always include the tag name
$tag_data[] = bbp_get_topic_tag_name();
// If capable, include a link to edit the tag
if (current_user_can('manage_topic_tags')) {
$tag_data[] = '<a href="' . esc_url(bbp_get_topic_tag_edit_link()) . '" class="bbp-edit-topic-tag-link">' . esc_html__('(Edit)', 'bbpress') . '</a>';
}
// Implode the results of the tag data
$current_text = sprintf(__('Topic Tag: %s', 'bbpress'), implode(' ', $tag_data));
} elseif (bbp_is_topic_tag_edit()) {
$current_text = __('Edit', 'bbpress');
} else {
$current_text = get_the_title();
}
$r = array('before' => '', 'after' => '', 'sep' => x_get_breadcrumb_delimiter(), 'pad_sep' => 0, 'sep_before' => '', 'sep_after' => '', 'crumb_before' => '', 'crumb_after' => '', 'include_home' => false, 'home_text' => x_get_breadcrumb_home_text(), 'include_root' => true, 'root_text' => bbp_get_forum_archive_title(), 'include_current' => true, 'current_text' => $current_text, 'current_before' => x_get_breadcrumb_current_before(), 'current_after' => x_get_breadcrumb_current_after());
return $r;
}
示例9: get_page_header_title
protected function get_page_header_title()
{
global $oxy_theme_options;
if (bbp_is_forum_archive()) {
return $oxy_theme_options['bbpress_header_forums'];
} else {
if (bbp_is_topic_archive()) {
return $oxy_theme_options['bbpress_header_topics'];
} else {
if (bbp_is_single_view()) {
return bbp_get_view_title();
} else {
if (bbp_is_single_forum()) {
return bbp_get_forum_title();
} else {
if (bbp_is_single_topic()) {
return bbp_get_topic_title();
} else {
if (bbp_is_topic_tag()) {
return __('Tag: ', 'omega-td') . bbp_get_topic_tag_name();
} else {
if (bbp_is_single_reply()) {
return bbp_get_reply_title();
} else {
if (bbp_is_topic_tag_edit()) {
return __('Edit', 'omega-td');
} else {
if (bbp_is_search()) {
return bbp_get_search_title();
} else {
if (bbp_is_single_user()) {
return bbp_get_displayed_user_field('display_name');
} else {
return get_the_title();
}
}
}
}
}
}
}
}
}
}
}
示例10: bbp_template_include_theme_compat
//.........这里部分代码省略.........
} else {
$new_title = apply_filters('the_title', $page->post_title);
}
// Reset post
bbp_theme_compat_reset_post(array('ID' => !empty($page->ID) ? $page->ID : 0, 'post_title' => bbp_get_topic_archive_title(), 'post_author' => 0, 'post_date' => 0, 'post_content' => $new_content, 'post_type' => bbp_get_topic_post_type(), 'post_status' => bbp_get_public_status_id(), 'is_archive' => true, 'comment_status' => 'closed'));
// Single Topic
} elseif (bbp_is_topic_edit() || bbp_is_single_topic()) {
// Split
if (bbp_is_topic_split()) {
$new_content = bbp_buffer_template_part('form', 'topic-split', false);
// Merge
} elseif (bbp_is_topic_merge()) {
$new_content = bbp_buffer_template_part('form', 'topic-merge', false);
// Edit
} elseif (bbp_is_topic_edit()) {
$new_content = $bbp_shortcodes->display_topic_form();
// Single
} else {
$new_content = $bbp_shortcodes->display_topic(array('id' => bbp_get_topic_id()));
}
// Reset post
bbp_theme_compat_reset_post(array('ID' => bbp_get_topic_id(), 'post_title' => bbp_get_topic_title(), 'post_author' => bbp_get_topic_author_id(), 'post_date' => 0, 'post_content' => $new_content, 'post_type' => bbp_get_topic_post_type(), 'post_status' => bbp_get_topic_status(), 'is_single' => true, 'comment_status' => 'closed'));
/** Replies ***********************************************************/
// Reply archive
} elseif (is_post_type_archive(bbp_get_reply_post_type())) {
// Reset post
bbp_theme_compat_reset_post(array('ID' => 0, 'post_title' => __('Replies', 'bbpress'), 'post_author' => 0, 'post_date' => 0, 'post_content' => $bbp_shortcodes->display_reply_index(), 'post_type' => bbp_get_reply_post_type(), 'post_status' => bbp_get_public_status_id(), 'comment_status' => 'closed'));
// Single Reply
} elseif (bbp_is_reply_edit() || bbp_is_single_reply()) {
// Move
if (bbp_is_reply_move()) {
$new_content = bbp_buffer_template_part('form', 'reply-move', false);
// Edit
} elseif (bbp_is_reply_edit()) {
$new_content = $bbp_shortcodes->display_reply_form();
// Single
} else {
$new_content = $bbp_shortcodes->display_reply(array('id' => get_the_ID()));
}
// Reset post
bbp_theme_compat_reset_post(array('ID' => bbp_get_reply_id(), 'post_title' => bbp_get_reply_title(), 'post_author' => bbp_get_reply_author_id(), 'post_date' => 0, 'post_content' => $new_content, 'post_type' => bbp_get_reply_post_type(), 'post_status' => bbp_get_reply_status(), 'comment_status' => 'closed'));
/** Views *************************************************************/
} elseif (bbp_is_single_view()) {
// Reset post
bbp_theme_compat_reset_post(array('ID' => 0, 'post_title' => bbp_get_view_title(), 'post_author' => 0, 'post_date' => 0, 'post_content' => $bbp_shortcodes->display_view(array('id' => get_query_var(bbp_get_view_rewrite_id()))), 'post_type' => '', 'post_status' => bbp_get_public_status_id(), 'comment_status' => 'closed'));
/** Search ************************************************************/
} elseif (bbp_is_search()) {
// Reset post
bbp_theme_compat_reset_post(array('ID' => 0, 'post_title' => bbp_get_search_title(), 'post_author' => 0, 'post_date' => 0, 'post_content' => $bbp_shortcodes->display_search(array('search' => get_query_var(bbp_get_search_rewrite_id()))), 'post_type' => '', 'post_status' => bbp_get_public_status_id(), 'comment_status' => 'closed'));
/** Topic Tags ********************************************************/
// Topic Tag Edit
} elseif (bbp_is_topic_tag_edit() || bbp_is_topic_tag()) {
// Stash the current term in a new var
set_query_var('bbp_topic_tag', get_query_var('term'));
// Show topics of tag
if (bbp_is_topic_tag()) {
$new_content = $bbp_shortcodes->display_topics_of_tag(array('id' => bbp_get_topic_tag_id()));
// Edit topic tag
} elseif (bbp_is_topic_tag_edit()) {
$new_content = $bbp_shortcodes->display_topic_tag_form();
}
// Reset the post with our new title
bbp_theme_compat_reset_post(array('ID' => 0, 'post_author' => 0, 'post_date' => 0, 'post_content' => $new_content, 'post_type' => '', 'post_title' => sprintf(__('Topic Tag: %s', 'bbpress'), '<span>' . bbp_get_topic_tag_name() . '</span>'), 'post_status' => bbp_get_public_status_id(), 'comment_status' => 'closed', 'is_tax' => true));
}
/**
* Bail if the template already matches a bbPress template. This includes
* archive-* and single-* WordPress post_type matches (allowing
* themes to use the expected format) as well as all bbPress-specific
* template files for users, topics, forums, etc...
*
* We do this after the above checks to prevent incorrect 404 body classes
* and header statuses, as well as to set the post global as needed.
*
* @see https://bbpress.trac.wordpress.org/ticket/1478/
*/
if (bbp_is_template_included()) {
return $template;
/**
* If we are relying on bbPress's built in theme compatibility to load
* the proper content, we need to intercept the_content, replace the
* output, and display ours instead.
*
* To do this, we first remove all filters from 'the_content' and hook
* our own function into it, which runs a series of checks to determine
* the context, and then uses the built in shortcodes to output the
* correct results from inside an output buffer.
*
* Uses bbp_get_theme_compat_templates() to provide fall-backs that
* should be coded without superfluous mark-up and logic (prev/next
* navigation, comments, date/time, etc...)
*
* Hook into the 'bbp_get_bbpress_template' to override the array of
* possible templates, or 'bbp_bbpress_template' to override the result.
*/
} elseif (bbp_is_theme_compat_active()) {
bbp_remove_all_filters('the_content');
$template = bbp_get_theme_compat_templates();
}
return apply_filters('bbp_template_include_theme_compat', $template);
}
示例11: breadcrumb_trail_get_bbpress_items
/**
* Gets the items for the breadcrumb trail if bbPress is installed.
*
* @since 0.5.0
* @access public
* @param array $args Mixed arguments for the menu.
* @return array List of items to be shown in the trail.
*/
function breadcrumb_trail_get_bbpress_items($args = array())
{
/* Set up a new trail items array. */
$trail = array();
/* Get the forum post type object. */
$post_type_object = get_post_type_object(bbp_get_forum_post_type());
/* If not viewing the forum root/archive page and a forum archive exists, add it. */
if (!empty($post_type_object->has_archive) && !bbp_is_forum_archive()) {
$trail[] = '<a href="' . get_post_type_archive_link(bbp_get_forum_post_type()) . '">' . bbp_get_forum_archive_title() . '</a>';
}
/* If viewing the forum root/archive. */
if (bbp_is_forum_archive()) {
$trail[] = "<span>" . bbp_get_forum_archive_title() . "</span>";
} elseif (bbp_is_topic_archive()) {
$trail[] = "<span>" . bbp_get_topic_archive_title() . "</span>";
} elseif (bbp_is_topic_tag()) {
$trail[] = "<span>" . bbp_get_topic_tag_name() . "</span>";
} elseif (bbp_is_topic_tag_edit()) {
$trail[] = '<a href="' . bbp_get_topic_tag_link() . '">' . bbp_get_topic_tag_name() . '</a>';
$trail[] = "<span>" . __('Edit', 'kleo_framework') . "</span>";
} elseif (bbp_is_single_view()) {
$trail[] = '<span>' . bbp_get_view_title() . '</span>';
} elseif (bbp_is_single_topic()) {
/* Get the queried topic. */
$topic_id = get_queried_object_id();
/* Get the parent items for the topic, which would be its forum (and possibly forum grandparents). */
$trail = array_merge($trail, breadcrumb_trail_get_parents(bbp_get_topic_forum_id($topic_id)));
/* If viewing a split, merge, or edit topic page, show the link back to the topic. Else, display topic title. */
if (bbp_is_topic_split() || bbp_is_topic_merge() || bbp_is_topic_edit()) {
$trail[] = '<a href="' . bbp_get_topic_permalink($topic_id) . '">' . bbp_get_topic_title($topic_id) . '</a>';
} else {
$trail[] = '<span>' . bbp_get_topic_title($topic_id) . '</span>';
}
/* If viewing a topic split page. */
if (bbp_is_topic_split()) {
$trail[] = "<span>" . __('Split', 'kleo_framework') . "</span>";
} elseif (bbp_is_topic_merge()) {
$trail[] = "<span>" . __('Merge', 'kleo_framework') . "</span>";
} elseif (bbp_is_topic_edit()) {
$trail[] = "<span>" . __('Edit', 'kleo_framework') . "</span>";
}
} elseif (bbp_is_single_reply()) {
/* Get the queried reply object ID. */
$reply_id = get_queried_object_id();
/* Get the parent items for the reply, which should be its topic. */
$trail = array_merge($trail, breadcrumb_trail_get_parents(bbp_get_reply_topic_id($reply_id)));
/* If viewing a reply edit page, link back to the reply. Else, display the reply title. */
if (bbp_is_reply_edit()) {
$trail[] = '<a href="' . bbp_get_reply_url($reply_id) . '">' . bbp_get_reply_title($reply_id) . '</a>';
$trail[] = "<span>" . __('Edit', 'kleo_framework') . "</span>";
} else {
$trail[] = '<span>' . bbp_get_reply_title($reply_id) . '</span>';
}
} elseif (bbp_is_single_forum()) {
/* Get the queried forum ID and its parent forum ID. */
$forum_id = get_queried_object_id();
$forum_parent_id = bbp_get_forum_parent_id($forum_id);
/* If the forum has a parent forum, get its parent(s). */
if (0 !== $forum_parent_id) {
$trail = array_merge($trail, breadcrumb_trail_get_parents($forum_parent_id));
}
/* Add the forum title to the end of the trail. */
$trail[] = '<span>' . bbp_get_forum_title($forum_id) . '</span>';
} elseif (bbp_is_single_user() || bbp_is_single_user_edit()) {
if (bbp_is_single_user_edit()) {
$trail[] = '<a href="' . bbp_get_user_profile_url() . '">' . bbp_get_displayed_user_field('display_name') . '</a>';
$trail[] = "<span>" . __('Edit', 'kleo_framework') . "</span>";
} else {
$trail[] = '<span>' . bbp_get_displayed_user_field('display_name') . '</span>';
}
}
/* Return the bbPress breadcrumb trail items. */
return apply_filters('breadcrumb_trail_get_bbpress_items', $trail, $args);
}