本文整理汇总了PHP中bbp_is_topic_merge函数的典型用法代码示例。如果您正苦于以下问题:PHP bbp_is_topic_merge函数的具体用法?PHP bbp_is_topic_merge怎么用?PHP bbp_is_topic_merge使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bbp_is_topic_merge函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bbp_template_include_theme_supports
/**
* Possibly intercept the template being loaded
*
* Listens to the 'template_include' filter and waits for any bbPress specific
* template condition to be met. If one is met and the template file exists,
* it will be used; otherwise
*
* Note that the _edit() checks are ahead of their counterparts, to prevent them
* from being stomped on accident.
*
* @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_search() To check if page is search
* @uses bbp_get_search_template() To get search 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_move() To check if page is reply move
* @uses bbp_get_reply_move_template() To get reply move 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
*
* @return string The path to the template file that is being used
*/
function bbp_template_include_theme_supports($template = '')
{
// Editing a user
if (bbp_is_single_user_edit() && ($new_template = bbp_get_single_user_edit_template())) {
// User favorites
} elseif (bbp_is_favorites() && ($new_template = bbp_get_favorites_template())) {
// User favorites
} elseif (bbp_is_subscriptions() && ($new_template = bbp_get_subscriptions_template())) {
// Viewing a user
} elseif (bbp_is_single_user() && ($new_template = bbp_get_single_user_template())) {
// Single View
} elseif (bbp_is_single_view() && ($new_template = bbp_get_single_view_template())) {
// Search
} elseif (bbp_is_search() && ($new_template = bbp_get_search_template())) {
// Forum edit
} elseif (bbp_is_forum_edit() && ($new_template = bbp_get_forum_edit_template())) {
// Single Forum
} elseif (bbp_is_single_forum() && ($new_template = bbp_get_single_forum_template())) {
// Forum Archive
} elseif (bbp_is_forum_archive() && ($new_template = bbp_get_forum_archive_template())) {
// Topic merge
} elseif (bbp_is_topic_merge() && ($new_template = bbp_get_topic_merge_template())) {
// Topic split
} elseif (bbp_is_topic_split() && ($new_template = bbp_get_topic_split_template())) {
// Topic edit
} elseif (bbp_is_topic_edit() && ($new_template = bbp_get_topic_edit_template())) {
// Single Topic
} elseif (bbp_is_single_topic() && ($new_template = bbp_get_single_topic_template())) {
// Topic Archive
} elseif (bbp_is_topic_archive() && ($new_template = bbp_get_topic_archive_template())) {
// Reply move
} elseif (bbp_is_reply_move() && ($new_template = bbp_get_reply_move_template())) {
// Editing a reply
} elseif (bbp_is_reply_edit() && ($new_template = bbp_get_reply_edit_template())) {
// Single Reply
} elseif (bbp_is_single_reply() && ($new_template = bbp_get_single_reply_template())) {
// Editing a topic tag
} elseif (bbp_is_topic_tag_edit() && ($new_template = bbp_get_topic_tag_edit_template())) {
// Viewing a topic tag
} elseif (bbp_is_topic_tag() && ($new_template = bbp_get_topic_tag_template())) {
}
// A bbPress template file was located, so override the WordPress template
// and use it to switch off bbPress's theme compatibility.
if (!empty($new_template)) {
$template = bbp_set_template_included($new_template);
}
return apply_filters('bbp_template_include_theme_supports', $template);
}
示例2: bbp_template_include_theme_supports
/**
* Possibly intercept the template being loaded
*
* Listens to the 'template_include' filter and waits for any bbPress specific
* template condition to be met. If one is met and the template file exists,
* it will be used; otherwise
*
* Note that the _edit() checks are ahead of their counterparts, to prevent them
* from being stomped on accident.
*
* @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
*
* @return string The path to the template file that is being used
*/
function bbp_template_include_theme_supports($template = '')
{
// Editing a user
if (bbp_is_single_user_edit() && ($new_template = bbp_get_single_user_edit_template())) {
// User favorites
} elseif (bbp_is_favorites() && ($new_template = bbp_get_favorites_template())) {
// User favorites
} elseif (bbp_is_subscriptions() && ($new_template = bbp_get_subscriptions_template())) {
// Viewing a user
} elseif (bbp_is_single_user() && ($new_template = bbp_get_single_user_template())) {
// Single View
} elseif (bbp_is_single_view() && ($new_template = bbp_get_single_view_template())) {
// Forum edit
} elseif (bbp_is_forum_edit() && ($new_template = bbp_get_forum_edit_template())) {
// Single Forum
} elseif (bbp_is_single_forum() && ($new_template = bbp_get_single_forum_template())) {
// Forum Archive
} elseif (bbp_is_forum_archive() && ($new_template = bbp_get_forum_archive_template())) {
// Topic merge
} elseif (bbp_is_topic_merge() && ($new_template = bbp_get_topic_merge_template())) {
// Topic split
} elseif (bbp_is_topic_split() && ($new_template = bbp_get_topic_split_template())) {
// Topic edit
} elseif (bbp_is_topic_edit() && ($new_template = bbp_get_topic_edit_template())) {
// Single Topic
} elseif (bbp_is_single_topic() && ($new_template = bbp_get_single_topic_template())) {
// Topic Archive
} elseif (bbp_is_topic_archive() && ($new_template = bbp_get_topic_archive_template())) {
// Editing a reply
} elseif (bbp_is_reply_edit() && ($new_template = bbp_get_reply_edit_template())) {
// Single Reply
} elseif (bbp_is_single_reply() && ($new_template = bbp_get_single_reply_template())) {
// Editing a topic tag
} elseif (bbp_is_topic_tag_edit() && ($new_template = bbp_get_topic_tag_edit_template())) {
// Viewing a topic tag
} elseif (bbp_is_topic_tag() && ($new_template = bbp_get_topic_tag_template())) {
}
// bbPress template file exists
if (!empty($new_template)) {
// Override the WordPress template with a bbPress one
$template = $new_template;
// @see: bbp_template_include_theme_compat()
bbpress()->theme_compat->bbpress_template = true;
}
return apply_filters('bbp_template_include_theme_supports', $template);
}
示例3: 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);
}
示例4: is_bbpress
/**
* Use the above is_() functions to return if in any bbPress page
*
* @since bbPress (r3344)
*
* @uses bbp_is_single_forum()
* @uses bbp_is_single_topic()
* @uses bbp_is_topic_edit()
* @uses bbp_is_topic_merge()
* @uses bbp_is_topic_split()
* @uses bbp_is_single_reply()
* @uses bbp_is_reply_edit()
* @uses bbp_is_reply_edit()
* @uses bbp_is_single_view()
* @uses bbp_is_single_user_edit()
* @uses bbp_is_single_user()
* @uses bbp_is_user_home()
* @uses bbp_is_subscriptions()
* @uses bbp_is_favorites()
* @uses bbp_is_topics_created()
* @return bool In a bbPress page
*/
function is_bbpress()
{
// Defalt to false
$retval = false;
/** Archives **************************************************************/
if (bbp_is_forum_archive()) {
$retval = true;
} elseif (bbp_is_topic_archive()) {
$retval = true;
} elseif (bbp_is_topic_tag()) {
$retval = true;
} elseif (bbp_is_topic_tag_edit()) {
$retval = true;
} elseif (bbp_is_single_forum()) {
$retval = true;
} elseif (bbp_is_single_topic()) {
$retval = true;
} elseif (bbp_is_single_reply()) {
$retval = true;
} elseif (bbp_is_topic_edit()) {
$retval = true;
} elseif (bbp_is_topic_merge()) {
$retval = true;
} elseif (bbp_is_topic_split()) {
$retval = true;
} elseif (bbp_is_reply_edit()) {
$retval = true;
} elseif (bbp_is_single_view()) {
$retval = true;
} elseif (bbp_is_single_user_edit()) {
$retval = true;
} elseif (bbp_is_single_user()) {
$retval = true;
} elseif (bbp_is_user_home()) {
$retval = true;
} elseif (bbp_is_user_home_edit()) {
$retval = true;
} elseif (bbp_is_topics_created()) {
$retval = true;
} elseif (bbp_is_favorites()) {
$retval = true;
} elseif (bbp_is_subscriptions()) {
$retval = true;
}
/** Done ******************************************************************/
return (bool) apply_filters('is_bbpress', $retval);
}
示例5: bbp_replace_the_content
/**
* Replaces the_content() if the post_type being displayed is one that would
* normally be handled by bbPress, but proper single page templates do not
* exist in the currently active theme.
*
* Note that we do *not* currently use is_main_query() here. This is because so
* many existing themes either use query_posts() or fail to use wp_reset_query()
* when running queries before the main loop, causing theme compat to fail.
*
* @since bbPress (r3034)
* @param string $content
* @return type
*/
function bbp_replace_the_content($content = '')
{
// Bail if not inside the query loop
if (!in_the_loop()) {
return $content;
}
$bbp = bbpress();
// Define local variable(s)
$new_content = '';
// Bail if shortcodes are unset somehow
if (!is_a($bbp->shortcodes, 'BBP_Shortcodes')) {
return $content;
}
// Use shortcode API to display forums/topics/replies because they are
// already output buffered and ready to fit inside the_content
/** Users *************************************************************/
// Profile View
if (bbp_is_single_user_edit() || bbp_is_single_user()) {
ob_start();
bbp_get_template_part('content', 'single-user');
$new_content = ob_get_contents();
ob_end_clean();
/** Forums ************************************************************/
// Forum archive
} elseif (bbp_is_forum_archive()) {
// Page exists where this archive should be
$page = bbp_get_page_by_path(bbp_get_root_slug());
if (!empty($page)) {
// Restore previously unset filters
bbp_restore_all_filters('the_content');
// Remove 'bbp_replace_the_content' filter to prevent infinite loops
remove_filter('the_content', 'bbp_replace_the_content');
// Start output buffer
ob_start();
// Grab the content of this page
$new_content = apply_filters('the_content', $page->post_content);
// Clean up the buffer
ob_end_clean();
// Add 'bbp_replace_the_content' filter back (@see $this::start())
add_filter('the_content', 'bbp_replace_the_content');
// No page so show the archive
} else {
$new_content = $bbp->shortcodes->display_forum_index();
}
// Forum Edit
} elseif (bbp_is_forum_edit()) {
$new_content = $bbp->shortcodes->display_forum_form();
// Single Forum
} elseif (bbp_is_single_forum()) {
$new_content = $bbp->shortcodes->display_forum(array('id' => get_the_ID()));
/** Topics ************************************************************/
// Topic archive
} elseif (bbp_is_topic_archive()) {
// Page exists where this archive should be
$page = bbp_get_page_by_path(bbp_get_topic_archive_slug());
if (!empty($page)) {
// Restore previously unset filters
bbp_restore_all_filters('the_content');
// Remove 'bbp_replace_the_content' filter to prevent infinite loops
remove_filter('the_content', 'bbp_replace_the_content');
// Start output buffer
ob_start();
// Grab the content of this page
$new_content = apply_filters('the_content', $page->post_content);
// Clean up the buffer
ob_end_clean();
// Add 'bbp_replace_the_content' filter back (@see $this::start())
add_filter('the_content', 'bbp_replace_the_content');
// No page so show the archive
} else {
$new_content = $bbp->shortcodes->display_topic_index();
}
// Topic Edit
} elseif (bbp_is_topic_edit()) {
// Split
if (bbp_is_topic_split()) {
ob_start();
bbp_get_template_part('form', 'topic-split');
$new_content = ob_get_contents();
ob_end_clean();
// Merge
} elseif (bbp_is_topic_merge()) {
ob_start();
bbp_get_template_part('form', 'topic-merge');
$new_content = ob_get_contents();
ob_end_clean();
// Edit
//.........这里部分代码省略.........
示例6: _bbpress_items
protected function _bbpress_items()
{
$item = array();
$post_type_object = get_post_type_object(bbp_get_forum_post_type());
if (!empty($post_type_object->has_archive) && !bbp_is_forum_archive()) {
$item[] = '<span typeof="v:Breadcrumb"><a href="' . get_post_type_archive_link(bbp_get_forum_post_type()) . '" property="v:title" rel="v:url"><span>' . bbp_get_forum_archive_title() . '</span></a></span>';
}
if (bbp_is_forum_archive()) {
$item[] = bbp_get_forum_archive_title();
} elseif (bbp_is_topic_archive()) {
$item[] = bbp_get_topic_archive_title();
} elseif (bbp_is_single_view()) {
$item[] = bbp_get_view_title();
} elseif (bbp_is_single_topic()) {
$topic_id = get_queried_object_id();
$item = array_merge($item, $this->_get_parents(bbp_get_topic_forum_id($topic_id)));
if (bbp_is_topic_split() || bbp_is_topic_merge() || bbp_is_topic_edit()) {
$item[] = '<span typeof="v:Breadcrumb"><a href="' . bbp_get_topic_permalink($topic_id) . '" property="v:title" rel="v:url"><span>' . bbp_get_topic_title($topic_id) . '</span></a></span>';
} else {
$item[] = bbp_get_topic_title($topic_id);
}
if (bbp_is_topic_split()) {
$item[] = __('Split', DH_DOMAIN);
} elseif (bbp_is_topic_merge()) {
$item[] = __('Merge', DH_DOMAIN);
} elseif (bbp_is_topic_edit()) {
$item[] = __('Edit', DH_DOMAIN);
}
} elseif (bbp_is_single_reply()) {
$reply_id = get_queried_object_id();
$item = array_merge($item, $this->_get_parents(bbp_get_reply_topic_id($reply_id)));
if (!bbp_is_reply_edit()) {
$item[] = bbp_get_reply_title($reply_id);
} else {
$item[] = '<span typeof="v:Breadcrumb"><a href="' . bbp_get_reply_url($reply_id) . '" property="v:title" rel="v:url"><span>' . bbp_get_reply_title($reply_id) . '</span></a></span>';
$item[] = __('Edit', DH_DOMAIN);
}
} elseif (bbp_is_single_forum()) {
$forum_id = get_queried_object_id();
$forum_parent_id = bbp_get_forum_parent_id($forum_id);
if (0 !== $forum_parent_id) {
$item = array_merge($item, $this->_get_parents($forum_parent_id));
}
$item[] = bbp_get_forum_title($forum_id);
} elseif (bbp_is_single_user() || bbp_is_single_user_edit()) {
if (bbp_is_single_user_edit()) {
$item[] = '<span typeof="v:Breadcrumb"><a href="' . bbp_get_user_profile_url() . '" property="v:title" rel="v:url" ><span>' . bbp_get_displayed_user_field('display_name') . '</span></a></span>';
$item[] = __('Edit', DH_DOMAIN);
} else {
$item[] = bbp_get_displayed_user_field('display_name');
}
}
return $item;
}
示例7: cupid_breadcrumb_get_bbpress_items
function cupid_breadcrumb_get_bbpress_items()
{
$item = array();
$post_type_object = get_post_type_object(bbp_get_forum_post_type());
if (!empty($post_type_object->has_archive) && !bbp_is_forum_archive()) {
$item[] = '<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . get_post_type_archive_link(bbp_get_forum_post_type()) . '">' . bbp_get_forum_archive_title() . '</a></li>';
}
if (bbp_is_forum_archive()) {
$item['last'] = bbp_get_forum_archive_title();
} elseif (bbp_is_topic_archive()) {
$item['last'] = bbp_get_topic_archive_title();
} elseif (bbp_is_single_view()) {
$item['last'] = bbp_get_view_title();
} elseif (bbp_is_single_topic()) {
$topic_id = get_queried_object_id();
$item = array_merge($item, cupid_breadcrumb_get_parents(bbp_get_topic_forum_id($topic_id)));
if (bbp_is_topic_split() || bbp_is_topic_merge() || bbp_is_topic_edit()) {
$item[] = '<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . bbp_get_topic_permalink($topic_id) . '">' . bbp_get_topic_title($topic_id) . '</a></li>';
} else {
$item['last'] = bbp_get_topic_title($topic_id);
}
if (bbp_is_topic_split()) {
$item['last'] = __('Split', 'cupid');
} elseif (bbp_is_topic_merge()) {
$item['last'] = __('Merge', 'cupid');
} elseif (bbp_is_topic_edit()) {
$item['last'] = __('Edit', 'cupid');
}
} elseif (bbp_is_single_reply()) {
$reply_id = get_queried_object_id();
$item = array_merge($item, cupid_breadcrumb_get_parents(bbp_get_reply_topic_id($reply_id)));
if (!bbp_is_reply_edit()) {
$item['last'] = bbp_get_reply_title($reply_id);
} else {
$item[] = '<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . bbp_get_reply_url($reply_id) . '">' . bbp_get_reply_title($reply_id) . '</a></li>';
$item['last'] = __('Edit', 'cupid');
}
} elseif (bbp_is_single_forum()) {
$forum_id = get_queried_object_id();
$forum_parent_id = bbp_get_forum_parent_id($forum_id);
if (0 !== $forum_parent_id) {
$item = array_merge($item, cupid_breadcrumb_get_parents($forum_parent_id));
}
$item['last'] = bbp_get_forum_title($forum_id);
} elseif (bbp_is_single_user() || bbp_is_single_user_edit()) {
if (bbp_is_single_user_edit()) {
$item[] = '<li typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . bbp_get_user_profile_url() . '">' . bbp_get_displayed_user_field('display_name') . '</a></li>';
$item['last'] = __('Edit', 'cupid');
} else {
$item['last'] = bbp_get_displayed_user_field('display_name');
}
}
return apply_filters('cupid_breadcrumb_get_bbpress_items', $item);
}
示例8: mk_theme_breadcrumbs
//.........这里部分代码省略.........
foreach ($breadcrumbs as $crumb) {
echo $crumb . '' . $delimiter;
}
echo get_the_title();
} elseif (is_attachment()) {
$parent = get_post($post->post_parent);
$cat = get_the_category($parent->ID);
$cat = $cat[0];
/* admin@innodron.com patch:
Fix for Catchable fatal error: Object of class WP_Error could not be converted to string
ref: https://wordpress.org/support/topic/catchable-fatal-error-object-of-class-wp_error-could-not-be-converted-to-string-11
*/
echo is_wp_error($cat_parents = get_category_parents($cat, TRUE, '' . $delimiter . '')) ? '' : $cat_parents;
/* end admin@innodron.com patch */
echo '<a href="' . get_permalink($parent) . '">' . $parent->post_title . '</a>' . $delimiter;
echo get_the_title();
} elseif (is_search()) {
echo __('Search results for “', 'mk_framework') . get_search_query() . '”';
} elseif (is_tag()) {
echo __('Tag “', 'mk_framework') . single_tag_title('', false) . '”';
} elseif (is_author()) {
$userdata = get_userdata(get_the_author_meta('ID'));
echo __('Author:', 'mk_framework') . ' ' . $userdata->display_name;
} elseif (is_day()) {
echo '<a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a>' . $delimiter;
echo '<a href="' . get_month_link(get_the_time('Y'), get_the_time('m')) . '">' . get_the_time('F') . '</a>' . $delimiter;
echo get_the_time('d');
} elseif (is_month()) {
echo '<a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a>' . $delimiter;
echo get_the_time('F');
} elseif (is_year()) {
echo get_the_time('Y');
}
}
}
if (get_query_var('paged')) {
echo ' (' . __('Page', 'mk_framework') . ' ' . get_query_var('paged') . ')';
}
if (is_tax()) {
$term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
if (function_exists('is_woocommerce') && is_woocommerce() && is_archive()) {
echo $delimiter;
}
echo '<span>' . $term->name . '</span>';
}
if (function_exists('is_bbpress') && is_bbpress()) {
$item = array();
$post_type_object = get_post_type_object(bbp_get_forum_post_type());
if (!empty($post_type_object->has_archive) && !bbp_is_forum_archive()) {
$item[] = '<a href="' . get_post_type_archive_link(bbp_get_forum_post_type()) . '">' . bbp_get_forum_archive_title() . '</a>';
}
if (bbp_is_forum_archive()) {
$item[] = bbp_get_forum_archive_title();
} elseif (bbp_is_topic_archive()) {
$item[] = bbp_get_topic_archive_title();
} elseif (bbp_is_single_view()) {
$item[] = bbp_get_view_title();
} elseif (bbp_is_single_topic()) {
$topic_id = get_queried_object_id();
$item = array_merge($item, mk_breadcrumbs_get_parents(bbp_get_topic_forum_id($topic_id)));
if (bbp_is_topic_split() || bbp_is_topic_merge() || bbp_is_topic_edit()) {
$item[] = '<a href="' . bbp_get_topic_permalink($topic_id) . '">' . bbp_get_topic_title($topic_id) . '</a>';
} else {
$item[] = bbp_get_topic_title($topic_id);
}
if (bbp_is_topic_split()) {
$item[] = __('Split', 'mk_framework');
} elseif (bbp_is_topic_merge()) {
$item[] = __('Merge', 'mk_framework');
} elseif (bbp_is_topic_edit()) {
$item[] = __('Edit', 'mk_framework');
}
} elseif (bbp_is_single_reply()) {
$reply_id = get_queried_object_id();
$item = array_merge($item, mk_breadcrumbs_get_parents(bbp_get_reply_topic_id($reply_id)));
if (!bbp_is_reply_edit()) {
$item[] = bbp_get_reply_title($reply_id);
} else {
$item[] = '<a href="' . bbp_get_reply_url($reply_id) . '">' . bbp_get_reply_title($reply_id) . '</a>';
$item[] = __('Edit', 'mk_framework');
}
} elseif (bbp_is_single_forum()) {
$forum_id = get_queried_object_id();
$forum_parent_id = bbp_get_forum_parent_id($forum_id);
if (0 !== $forum_parent_id) {
$item = array_merge($item, mk_breadcrumbs_get_parents($forum_parent_id));
}
$item[] = bbp_get_forum_title($forum_id);
} elseif (bbp_is_single_user() || bbp_is_single_user_edit()) {
if (bbp_is_single_user_edit()) {
$item[] = '<a href="' . bbp_get_user_profile_url() . '">' . bbp_get_displayed_user_field('display_name') . '</a>';
$item[] = __('Edit', 'mk_framework');
} else {
$item[] = bbp_get_displayed_user_field('display_name');
}
}
echo implode($delimiter, $item);
}
echo "</div></div>";
}
示例9: breadcrumbs_plus_get_bbpress_items
/**
* Gets the items for the breadcrumb item if bbPress is installed.
*
* @since 0.4
*
* @param array $args Mixed arguments for the menu.
* @return array List of items to be shown in the item.
*/
function breadcrumbs_plus_get_bbpress_items($args = array())
{
$item = array();
$post_type_object = get_post_type_object(bbp_get_forum_post_type());
if (!empty($post_type_object->has_archive) && !bbp_is_forum_archive()) {
if (function_exists('bp_is_active')) {
global $bp;
// we're outside the loop!
// Assign some variables here
$page1 = isset($bp->members->root_slug) ? $bp->members->root_slug : '';
// slug for the Members page. The BuddyPress default is 'members'.
$page2 = isset($bp->groups->root_slug) ? $bp->groups->root_slug : '';
// slug for the Groups page. The BuddyPress default is 'groups'.
$page3 = isset($bp->activity->root_slug) ? $bp->activity->root_slug : '';
// slug for the Activity page. The BuddyPress default is 'activity'.
$page4 = isset($bp->forums->root_slug) ? $bp->forums->root_slug : '';
// slug for the Forums page. The BuddyPress default is 'forums'.
$page5 = isset($bp->achievements->root_slug) ? $bp->achievements->root_slug : '';
// slug for the Achievements page. The BuddyPress default is 'achievements'.
if (!bp_is_blog_page() && (is_page() || is_page($page1) || is_page($page2) || is_page($page3) || is_page($page4) || is_page($page5)) && !bp_is_user() && !bp_is_single_item() && !bp_is_register_page()) {
$item[] = '';
}
if (bp_is_user() && !bp_is_register_page()) {
$item[] = '';
}
} else {
//$item[] = '<div class="vbreadcrumb" typeof="v:Breadcrumb"><a href="' . get_post_type_archive_link( bbp_get_forum_post_type() ) . '" rel="v:url" property="v:title">' . bbp_get_forum_archive_title() . '</a></div>';
}
}
if (bbp_is_forum_archive()) {
$item[] = bbp_get_forum_archive_title();
} else {
$item[] = '<div class="vbreadcrumb" typeof="v:Breadcrumb"><a href="' . get_post_type_archive_link(bbp_get_forum_post_type()) . '" rel="v:url" property="v:title">' . bbp_get_forum_archive_title() . '</a></div>';
}
if (bbp_is_topic_archive()) {
$item[] = bbp_get_topic_archive_title();
} elseif (bbp_is_single_view()) {
$item[] = bbp_get_view_title();
} elseif (bbp_is_single_topic()) {
$topic_id = get_queried_object_id();
$item = array_merge($item, breadcrumbs_plus_get_parents(bbp_get_topic_forum_id($topic_id)));
if (bbp_is_topic_split() || bbp_is_topic_merge() || bbp_is_topic_edit()) {
$item[] = '<div class="vbreadcrumb" typeof="v:Breadcrumb"><a href="' . bbp_get_topic_permalink($topic_id) . '" rel="v:url" property="v:title">' . bbp_get_topic_title($topic_id) . '</a></div>';
} else {
$item[] = '';
}
if (bbp_is_topic_split()) {
$item[] = __('Split', 'framework');
} elseif (bbp_is_topic_merge()) {
$item[] = __('Merge', 'framework');
} elseif (bbp_is_topic_edit()) {
$item[] = __('Edit', 'framework');
}
} elseif (bbp_is_single_reply()) {
$reply_id = get_queried_object_id();
$item = array_merge($item, breadcrumbs_plus_get_parents(bbp_get_reply_topic_id($reply_id)));
if (!bbp_is_reply_edit()) {
$item[] = bbp_get_reply_title($reply_id);
} else {
$item[] = '<div class="vbreadcrumb" typeof="v:Breadcrumb"><a href="' . bbp_get_reply_url($reply_id) . '" rel="v:url" property="v:title">' . bbp_get_reply_title($reply_id) . '</a></div>';
$item[] = __('Edit', 'framework');
}
} elseif (bbp_is_single_forum()) {
$forum_id = get_queried_object_id();
$forum_parent_id = bbp_get_forum_parent_id($forum_id);
if (0 !== $forum_parent_id) {
$item = array_merge($item, breadcrumbs_plus_get_parents($forum_parent_id));
}
$item[] = bbp_get_forum_title($forum_id);
} elseif (bbp_is_single_user() || bbp_is_single_user_edit()) {
if (bbp_is_single_user_edit()) {
$item[] = '<div class="vbreadcrumb" typeof="v:Breadcrumb"><a href="' . bbp_get_user_profile_url() . '" rel="v:url" property="v:title">' . bbp_get_displayed_user_field('display_name') . '</a></div>';
$item[] = __('Edit', 'framework');
} else {
$item[] = bbp_get_displayed_user_field('display_name');
}
}
return apply_filters('breadcrumbs_plus_get_bbpress_items', $item, $args);
}
示例10: breadcrumbs_plus_get_bbpress_items
/**
* Gets the items for the breadcrumb item if bbPress is installed.
*
* @since 0.4
*
* @param array $args Mixed arguments for the menu.
* @return array List of items to be shown in the item.
*/
function breadcrumbs_plus_get_bbpress_items($args = array())
{
$item = array();
$post_type_object = get_post_type_object(bbp_get_forum_post_type());
if (!empty($post_type_object->has_archive) && !bbp_is_forum_archive()) {
$item[] = '<a href="' . get_post_type_archive_link(bbp_get_forum_post_type()) . '">' . bbp_get_forum_archive_title() . '</a>';
}
if (bbp_is_forum_archive()) {
$item[] = bbp_get_forum_archive_title();
} elseif (bbp_is_topic_archive()) {
$item[] = bbp_get_topic_archive_title();
} elseif (bbp_is_single_view()) {
$item[] = bbp_get_view_title();
} elseif (bbp_is_single_topic()) {
$topic_id = get_queried_object_id();
$item = array_merge($item, breadcrumbs_plus_get_parents(bbp_get_topic_forum_id($topic_id)));
if (bbp_is_topic_split() || bbp_is_topic_merge() || bbp_is_topic_edit()) {
$item[] = '<a href="' . bbp_get_topic_permalink($topic_id) . '">' . bbp_get_topic_title($topic_id) . '</a>';
} else {
$item[] = bbp_get_topic_title($topic_id);
}
if (bbp_is_topic_split()) {
$item[] = __('Split', 'theme_front');
} elseif (bbp_is_topic_merge()) {
$item[] = __('Merge', 'theme_front');
} elseif (bbp_is_topic_edit()) {
$item[] = __('Edit', 'theme_front');
}
} elseif (bbp_is_single_reply()) {
$reply_id = get_queried_object_id();
$item = array_merge($item, breadcrumbs_plus_get_parents(bbp_get_reply_topic_id($reply_id)));
if (!bbp_is_reply_edit()) {
$item[] = bbp_get_reply_title($reply_id);
} else {
$item[] = '<a href="' . bbp_get_reply_url($reply_id) . '">' . bbp_get_reply_title($reply_id) . '</a>';
$item[] = __('Edit', 'theme_front');
}
} elseif (bbp_is_single_forum()) {
$forum_id = get_queried_object_id();
$forum_parent_id = bbp_get_forum_parent($forum_id);
if (0 !== $forum_parent_id) {
$item = array_merge($item, breadcrumbs_plus_get_parents($forum_parent_id));
}
$item[] = bbp_get_forum_title($forum_id);
} elseif (bbp_is_single_user() || bbp_is_single_user_edit()) {
if (bbp_is_single_user_edit()) {
$item[] = '<a href="' . bbp_get_user_profile_url() . '">' . bbp_get_displayed_user_field('display_name') . '</a>';
$item[] = __('Edit');
} else {
$item[] = bbp_get_displayed_user_field('display_name');
}
}
return apply_filters('breadcrumbs_plus_get_bbpress_items', $item, $args);
}
示例11: bbp_template_include_theme_compat
//.........这里部分代码省略.........
} elseif (bbp_is_forum_edit()) {
// 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' => $bbp_shortcodes->display_forum_form(), 'post_type' => bbp_get_forum_post_type(), 'post_status' => bbp_get_forum_visibility(), 'is_single' => true, 'comment_status' => 'closed'));
} elseif (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' => $bbp_shortcodes->display_forum(array('id' => 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()) {
// Page exists where this archive should be
$page = bbp_get_page_by_path(bbp_get_topic_archive_slug());
// Should we replace the content...
if (empty($page->post_content)) {
$new_content = $bbp_shortcodes->display_topic_index();
// ...or use the existing page content?
} else {
$new_content = apply_filters('the_content', $page->post_content);
}
// Should we replace the title...
if (empty($page->post_title)) {
$new_title = bbp_get_topic_archive_title();
// ...or use the existing page title?
} 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
示例12: get_context
//.........这里部分代码省略.........
BBPRESS CONTEXT
---------------------------------------------*/
} elseif (class_exists('bbPress') && is_bbpress()) {
// bbPress Defaults
$classes[] = 'bbpress';
$classes[] = 'forums';
$crumbs[] = bbp_is_forum_archive() ? "Forums" : '<a href="' . get_post_type_archive_link('forum') . '">Forums</a>';
// Main Forum Archive
if (bbp_is_forum_archive()) {
$title = SITENAME . " Forums";
$desc = "Get involved in the community on the " . SITENAME . " forums.";
// Recent Topics
} elseif (bbp_is_topic_archive()) {
$title = "Recent Topics in the " . SITENAME . " Forums";
$desc = "Browse a list of the most recent topics in the " . SITENAME . " Forums.";
$crumbs[] = "Recent Topics";
// Single Forum
} elseif (bbp_is_single_forum()) {
$title = $object->post_title;
$desc = $object->post_content;
// Loop through parent forums
$parent_id = bbp_get_forum_parent_id($id);
if (0 != $parent_id) {
$crumbs = array_merge($crumbs, $this->parent_crumbs($parent_id));
}
$crumbs[] = $object->post_title;
// Single Topic
} elseif (bbp_is_single_topic()) {
$title = $object->post_title;
$desc = bbp_get_topic_excerpt($id);
$crumbs = array_merge($crumbs, $this->parent_crumbs(bbp_get_topic_forum_id($id)));
$crumbs[] = $object->post_title;
// Edit Topic
} elseif (bbp_is_topic_split() || bbp_is_topic_merge() || bbp_is_topic_edit()) {
$title = 'Edit Topic' . $sep . $object->post_title;
$desc = bbp_get_topic_excerpt($id);
$crumbs = array_merge($crumbs, $this->parent_crumbs($id));
// Tag the specific task
if (bbp_is_topic_split()) {
$crumbs[] = 'Split Topic';
} elseif (bbp_is_topic_merge()) {
$crumbs[] = 'Merge Topic';
} elseif (bbp_is_topic_edit()) {
$crumbs[] = 'Edit Topic';
}
// Edit Reply
} elseif (bbp_is_reply_edit()) {
$title = 'Edit Reply' . $sep . bbp_get_reply_topic_title($id);
$desc = bbp_get_reply_excerpt($id);
$crumbs = array_merge($crumbs, $this->parent_crumbs(bbp_get_reply_topic_id($id)));
$crumbs[] = 'Edit Reply';
}
/*--------------------------------------------
WORDPRESS CONTEXT
---------------------------------------------*/
} else {
// Singular Posts and Pages
if (is_singular()) {
$title = $object->post_title;
$desc = get_post_meta($id, 'description', true);
// If no description is found, use an excerpt
if (empty($desc)) {
$desc = get_post_field('post_excerpt', $id);
}
// Check for custom template
$template = get_post_meta($id, "_wp_{$object->post_type}_template", true);
示例13: 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);
}
示例14: bbp_replace_the_content
/**
* Replaces the_content() if the post_type being displayed is one that would
* normally be handled by bbPress, but proper single page templates do not
* exist in the currently active theme.
*
* @since bbPress (r3034)
* @param string $content
* @return type
*/
function bbp_replace_the_content($content = '')
{
$bbp = bbpress();
// Define local variable(s)
$new_content = '';
// Bail if shortcodes are unset somehow
if (!is_a($bbp->shortcodes, 'BBP_Shortcodes')) {
return $content;
}
// Use shortcode API to display forums/topics/replies because they are
// already output buffered and ready to fit inside the_content
/** Users *************************************************************/
// Profile View
if (bbp_is_single_user()) {
ob_start();
bbp_get_template_part('content', 'single-user');
$new_content = ob_get_contents();
ob_end_clean();
// Profile Edit
} elseif (bbp_is_single_user_edit()) {
ob_start();
bbp_get_template_part('content', 'single-user-edit');
$new_content = ob_get_contents();
ob_end_clean();
/** Forums ************************************************************/
// Reply Edit
} elseif (bbp_is_forum_edit()) {
$new_content = $bbp->shortcodes->display_forum_form();
// Forum archive
} elseif (bbp_is_forum_archive()) {
// Page exists where this archive should be
$page = bbp_get_page_by_path(bbp_get_root_slug());
if (!empty($page)) {
// Restore previously unset filters
bbp_restore_all_filters('the_content');
// Remove 'bbp_replace_the_content' filter to prevent infinite loops
remove_filter('the_content', 'bbp_replace_the_content');
// Start output buffer
ob_start();
// Grab the content of this page
$new_content = apply_filters('the_content', $page->post_content);
// Clean up the buffer
ob_end_clean();
// Add 'bbp_replace_the_content' filter back (@see $this::start())
add_filter('the_content', 'bbp_replace_the_content');
// No page so show the archive
} else {
$new_content = $bbp->shortcodes->display_forum_index();
}
/** Topics ************************************************************/
// Topic archive
} elseif (bbp_is_topic_archive()) {
// Page exists where this archive should be
$page = bbp_get_page_by_path(bbp_get_topic_archive_slug());
if (!empty($page)) {
// Restore previously unset filters
bbp_restore_all_filters('the_content');
// Remove 'bbp_replace_the_content' filter to prevent infinite loops
remove_filter('the_content', 'bbp_replace_the_content');
// Start output buffer
ob_start();
// Grab the content of this page
$new_content = apply_filters('the_content', $page->post_content);
// Clean up the buffer
ob_end_clean();
// Add 'bbp_replace_the_content' filter back (@see $this::start())
add_filter('the_content', 'bbp_replace_the_content');
// No page so show the archive
} else {
$new_content = $bbp->shortcodes->display_topic_index();
}
// Single topic
} elseif (bbp_is_topic_edit()) {
// Split
if (bbp_is_topic_split()) {
ob_start();
bbp_get_template_part('form', 'topic-split');
$new_content = ob_get_contents();
ob_end_clean();
// Merge
} elseif (bbp_is_topic_merge()) {
ob_start();
bbp_get_template_part('form', 'topic-merge');
$new_content = ob_get_contents();
ob_end_clean();
// Edit
} else {
$new_content = $bbp->shortcodes->display_topic_form();
}
/** Replies ***********************************************************/
// Reply archive
//.........这里部分代码省略.........
示例15: wm_bbp_content_type
function wm_bbp_content_type($content_type)
{
//Preparing output
if (bbp_is_search() || bbp_is_topic_tag() || bbp_is_single_view()) {
$content_type = 'bbpress-archive';
} elseif (bbp_is_single_reply() || bbp_is_topic_edit() || bbp_is_topic_merge() || bbp_is_topic_split() || bbp_is_reply_edit() || bbp_is_reply_move() || bbp_is_topic_tag_edit() || bbp_is_single_user() || bbp_is_single_user_edit()) {
$content_type = 'bbpress-article';
}
//Output
return apply_filters('wmhook_wm_bbp_content_type_output', $content_type);
}