当前位置: 首页>>代码示例>>PHP>>正文


PHP bbp_is_topic_tag函数代码示例

本文整理汇总了PHP中bbp_is_topic_tag函数的典型用法代码示例。如果您正苦于以下问题:PHP bbp_is_topic_tag函数的具体用法?PHP bbp_is_topic_tag怎么用?PHP bbp_is_topic_tag使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了bbp_is_topic_tag函数的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_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);
}
开发者ID:hscale,项目名称:webento,代码行数:80,代码来源:template-loader.php

示例2: bbp_has_topics

/**
 * The main topic loop. WordPress makes this easy for us
 *
 * @since bbPress (r2485)
 *
 * @param mixed $args All the arguments supported by {@link WP_Query}
 * @uses current_user_can() To check if the current user can edit other's topics
 * @uses bbp_is_user_bozo() To add the bozo post status
 * @uses bbp_get_topic_post_type() To get the topic post type
 * @uses WP_Query To make query and get the topics
 * @uses is_page() To check if it's a page
 * @uses bbp_is_single_forum() To check if it's a forum
 * @uses bbp_get_forum_id() To get the forum id
 * @uses bbp_get_paged() To get the current page value
 * @uses bbp_get_super_stickies() To get the super stickies
 * @uses bbp_get_stickies() To get the forum stickies
 * @uses wpdb::get_results() To execute our query and get the results
 * @uses WP_Rewrite::using_permalinks() To check if the blog is using permalinks
 * @uses get_permalink() To get the permalink
 * @uses add_query_arg() To add custom args to the url
 * @uses apply_filters() Calls 'bbp_topics_pagination' with the pagination args
 * @uses paginate_links() To paginate the links
 * @uses apply_filters() Calls 'bbp_has_topics' with
 *                        bbPres::topic_query::have_posts()
 *                        and bbPres::topic_query
 * @return object Multidimensional array of topic information
 */
function bbp_has_topics($args = '')
{
    global $wp_rewrite;
    // What are the default allowed statuses (based on user caps)
    if (bbp_get_view_all()) {
        $post_statuses = array(bbp_get_public_status_id(), bbp_get_closed_status_id(), bbp_get_spam_status_id(), bbp_get_trash_status_id());
    } else {
        $post_statuses = array(bbp_get_public_status_id(), bbp_get_closed_status_id());
    }
    // Add the bozo status if user is a bozo
    if (bbp_is_user_bozo()) {
        $post_statuses[] = bbp_get_bozo_status_id();
    }
    $default_topic_search = !empty($_REQUEST['ts']) ? $_REQUEST['ts'] : false;
    $default_show_stickies = (bool) (bbp_is_single_forum() || bbp_is_topic_archive()) && false === $default_topic_search;
    $default_post_parent = bbp_is_single_forum() ? bbp_get_forum_id() : 'any';
    $default_post_status = join(',', $post_statuses);
    // Default argument array
    $default = array('post_type' => bbp_get_topic_post_type(), 'post_parent' => $default_post_parent, 'post_status' => $default_post_status, 'meta_key' => '_bbp_last_active_time', 'orderby' => 'meta_value', 'order' => 'DESC', 'posts_per_page' => bbp_get_topics_per_page(), 'paged' => bbp_get_paged(), 's' => $default_topic_search, 'show_stickies' => $default_show_stickies, 'max_num_pages' => false);
    // Maybe query for topic tags
    if (bbp_is_topic_tag()) {
        $default['term'] = bbp_get_topic_tag_slug();
        $default['taxonomy'] = bbp_get_topic_tag_tax_id();
    }
    $bbp_t = bbp_parse_args($args, $default, 'has_topics');
    // Extract the query variables
    extract($bbp_t);
    // Get bbPress
    $bbp = bbpress();
    // Call the query
    $bbp->topic_query = new WP_Query($bbp_t);
    // Set post_parent back to 0 if originally set to 'any'
    if ('any' == $bbp_t['post_parent']) {
        $bbp_t['post_parent'] = $post_parent = 0;
    }
    // Limited the number of pages shown
    if (!empty($max_num_pages)) {
        $bbp->topic_query->max_num_pages = $max_num_pages;
    }
    // Put sticky posts at the top of the posts array
    if (!empty($show_stickies) && $paged <= 1) {
        // Get super stickies and stickies in this forum
        $stickies = bbp_get_super_stickies();
        $stickies = !empty($post_parent) ? array_merge($stickies, bbp_get_stickies($post_parent)) : $stickies;
        $stickies = array_unique($stickies);
        // We have stickies
        if (is_array($stickies) && !empty($stickies)) {
            // Setup the number of stickies and reset offset to 0
            $num_topics = count($bbp->topic_query->posts);
            $sticky_offset = 0;
            // Loop over topics and relocate stickies to the front.
            for ($i = 0; $i < $num_topics; $i++) {
                if (in_array($bbp->topic_query->posts[$i]->ID, $stickies)) {
                    $sticky = $bbp->topic_query->posts[$i];
                    // Remove sticky from current position
                    array_splice($bbp->topic_query->posts, $i, 1);
                    // Move to front, after other stickies
                    array_splice($bbp->topic_query->posts, $sticky_offset, 0, array($sticky));
                    // Increment the sticky offset.  The next sticky will be placed at this offset.
                    $sticky_offset++;
                    // Remove post from sticky posts array
                    $offset = array_search($sticky->ID, $stickies);
                    // Cleanup
                    unset($stickies[$offset]);
                    unset($sticky);
                }
            }
            // If any posts have been excluded specifically, Ignore those that are sticky.
            if (!empty($stickies) && !empty($post__not_in)) {
                $stickies = array_diff($stickies, $post__not_in);
            }
            // Fetch sticky posts that weren't in the query results
            if (!empty($stickies)) {
//.........这里部分代码省略.........
开发者ID:rmccue,项目名称:bbPress,代码行数:101,代码来源:bbp-topic-template.php

示例3: display_topics_of_tag

 /**
  * Display the contents of a specific topic tag in an output buffer
  * and return to ensure that post/page contents are displayed first.
  *
  * @since bbPress (r3110)
  *
  * @param array $attr
  * @param string $content
  * @uses get_template_part()
  * @return string
  */
 public function display_topics_of_tag($attr, $content = '')
 {
     // Sanity check required info
     if (!empty($content) || (empty($attr['id']) || !is_numeric($attr['id']))) {
         return $content;
     }
     // Unset globals
     $this->unset_globals();
     // Filter the query
     if (!bbp_is_topic_tag()) {
         add_filter('bbp_before_has_topics_parse_args', array($this, 'display_topics_of_tag_query'));
     }
     // Start output buffer
     $this->start('bbp_topic_tag');
     // Set passed attribute to $ag_id for clarity
     bbpress()->current_topic_tag_id = $tag_id = $attr['id'];
     // Output template
     bbp_get_template_part('content', 'archive-topic');
     // Return contents of output buffer
     return $this->end();
 }
开发者ID:hscale,项目名称:webento,代码行数:32,代码来源:shortcodes.php

示例4:

<?php

/**
 * Topics Loop
 *
 * @package bbPress
 * @subpackage Theme
 */
?>

<?php 
if (!bbp_is_topic_tag() && !strpos($_SERVER['REQUEST_URI'], '/forums/view/')) {
    ?>
  <?php 
    do_action('bbp_template_before_topics_loop');
    ?>
  <a href="<?php 
    echo add_query_arg(array('order' => 'DESC'), bbp_get_forum_permalink(bbp_get_forum_id()));
    ?>
"
  <?php 
    if (isset($_REQUEST['order']) && $_REQUEST['order'] && $_REQUEST['order'] == 'DESC') {
        echo 'class="order-active"';
    }
    ?>
  >Newest</a> |
  <a href="<?php 
    echo add_query_arg(array('order' => 'ASC'), bbp_get_forum_permalink(bbp_get_forum_id()));
    ?>
"
  <?php 
开发者ID:paulmedwal,项目名称:edxforumspublic,代码行数:31,代码来源:loop-topics.php

示例5: bbp_has_topics

/**
 * The main topic loop. WordPress makes this easy for us
 *
 * @since 2.0.0 bbPress (r2485)
 *
 * @param array $args All the arguments supported by {@link WP_Query}
 * @uses current_user_can() To check if the current user can edit other's topics
 * @uses bbp_get_topic_post_type() To get the topic post type
 * @uses WP_Query To make query and get the topics
 * @uses is_page() To check if it's a page
 * @uses bbp_is_single_forum() To check if it's a forum
 * @uses bbp_get_forum_id() To get the forum id
 * @uses bbp_get_paged() To get the current page value
 * @uses bbp_get_super_stickies() To get the super stickies
 * @uses bbp_get_stickies() To get the forum stickies
 * @uses bbp_use_pretty_urls() To check if the site is using pretty URLs
 * @uses get_permalink() To get the permalink
 * @uses add_query_arg() To add custom args to the url
 * @uses apply_filters() Calls 'bbp_topics_pagination' with the pagination args
 * @uses paginate_links() To paginate the links
 * @uses apply_filters() Calls 'bbp_has_topics' with
 *                        bbPres::topic_query::have_posts()
 *                        and bbPres::topic_query
 * @return object Multidimensional array of topic information
 */
function bbp_has_topics($args = array())
{
    /** Defaults **************************************************************/
    // Other defaults
    $default_topic_search = !empty($_REQUEST['ts']) ? $_REQUEST['ts'] : false;
    $default_show_stickies = (bool) (bbp_is_single_forum() || bbp_is_topic_archive()) && false === $default_topic_search;
    $default_post_parent = bbp_is_single_forum() ? bbp_get_forum_id() : 'any';
    // Default argument array
    $default = array('post_type' => bbp_get_topic_post_type(), 'post_parent' => $default_post_parent, 'meta_key' => '_bbp_last_active_time', 'meta_type' => 'DATETIME', 'orderby' => 'meta_value', 'order' => 'DESC', 'posts_per_page' => bbp_get_topics_per_page(), 'paged' => bbp_get_paged(), 'show_stickies' => $default_show_stickies, 'max_num_pages' => false);
    // Only add 's' arg if searching for topics
    // See https://bbpress.trac.wordpress.org/ticket/2607
    if (!empty($default_topic_search)) {
        $default['s'] = $default_topic_search;
    }
    // What are the default allowed statuses (based on user caps)
    if (bbp_get_view_all()) {
        // Default view=all statuses
        $post_statuses = array(bbp_get_public_status_id(), bbp_get_closed_status_id(), bbp_get_spam_status_id(), bbp_get_trash_status_id(), bbp_get_pending_status_id());
        // Add support for private status
        if (current_user_can('read_private_topics')) {
            $post_statuses[] = bbp_get_private_status_id();
        }
        // Join post statuses together
        $default['post_status'] = implode(',', $post_statuses);
        // Lean on the 'perm' query var value of 'readable' to provide statuses
    } else {
        $default['perm'] = 'readable';
    }
    // Maybe query for topic tags
    if (bbp_is_topic_tag()) {
        $default['term'] = bbp_get_topic_tag_slug();
        $default['taxonomy'] = bbp_get_topic_tag_tax_id();
    }
    /** Setup *****************************************************************/
    // Parse arguments against default values
    $r = bbp_parse_args($args, $default, 'has_topics');
    // Get bbPress
    $bbp = bbpress();
    // Call the query
    $bbp->topic_query = new WP_Query($r);
    // Set post_parent back to 0 if originally set to 'any'
    if ('any' === $r['post_parent']) {
        $r['post_parent'] = 0;
    }
    // Limited the number of pages shown
    if (!empty($r['max_num_pages'])) {
        $bbp->topic_query->max_num_pages = $r['max_num_pages'];
    }
    /** Stickies **************************************************************/
    // Put sticky posts at the top of the posts array
    if (!empty($r['show_stickies']) && $r['paged'] <= 1) {
        // Get super stickies and stickies in this forum
        $stickies = bbp_get_super_stickies();
        // Get stickies for current forum
        if (!empty($r['post_parent'])) {
            $stickies = array_merge($stickies, bbp_get_stickies($r['post_parent']));
        }
        // Remove any duplicate stickies
        $stickies = array_unique($stickies);
        // We have stickies
        if (is_array($stickies) && !empty($stickies)) {
            // Start the offset at -1 so first sticky is at correct 0 offset
            $sticky_offset = -1;
            // Loop over topics and relocate stickies to the front.
            foreach ($stickies as $sticky_index => $sticky_ID) {
                // Get the post offset from the posts array
                $post_offsets = wp_filter_object_list($bbp->topic_query->posts, array('ID' => $sticky_ID), 'OR', 'ID');
                // Continue if no post offsets
                if (empty($post_offsets)) {
                    continue;
                }
                // Loop over posts in current query and splice them into position
                foreach (array_keys($post_offsets) as $post_offset) {
                    $sticky_offset++;
                    $sticky = $bbp->topic_query->posts[$post_offset];
//.........这里部分代码省略.........
开发者ID:joeyblake,项目名称:bbpress,代码行数:101,代码来源:template.php

示例6: 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 '&raquo;'. 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 = '&raquo;', $seplocation = '')
{
    // Store original title to compare
    $_title = $title;
    /** Archives **************************************************************/
    // Forum Archive
    if (bbp_is_forum_archive()) {
        $title = bbp_get_forum_archive_title();
        // Topic Archive
    } elseif (bbp_is_topic_archive()) {
        $title = bbp_get_topic_archive_title();
        /** Singles ***************************************************************/
        // Forum page
    } elseif (bbp_is_single_forum()) {
        $title = sprintf(__('Forum: %s', 'bbpress'), bbp_get_forum_title());
        // Topic page
    } elseif (bbp_is_single_topic()) {
        $title = sprintf(__('Topic: %s', 'bbpress'), bbp_get_topic_title());
        // Replies
    } elseif (bbp_is_single_reply()) {
        $title = bbp_get_reply_title();
        // Topic tag page (or edit)
    } elseif (bbp_is_topic_tag() || bbp_is_topic_tag_edit() || get_query_var('bbp_topic_tag')) {
        $term = get_queried_object();
        $title = sprintf(__('Topic Tag: %s', 'bbpress'), $term->name);
        /** Users *****************************************************************/
        // Profile page
    } elseif (bbp_is_single_user()) {
        // Current users profile
        if (bbp_is_user_home()) {
            $title = __('Your Profile', 'bbpress');
            // Other users profile
        } else {
            $userdata = get_userdata(bbp_get_user_id());
            $title = sprintf(__('%s\'s Profile', 'bbpress'), $userdata->display_name);
        }
        // Profile edit page
    } elseif (bbp_is_single_user_edit()) {
        // Current users profile
        if (bbp_is_user_home_edit()) {
            $title = __('Edit Your Profile', 'bbpress');
            // Other users profile
        } else {
            $userdata = get_userdata(bbp_get_user_id());
            $title = sprintf(__('Edit %s\'s Profile', 'bbpress'), $userdata->display_name);
        }
        /** Views *****************************************************************/
        // Views
    } elseif (bbp_is_single_view()) {
        $title = sprintf(__('View: %s', 'bbpress'), bbp_get_view_title());
    }
    // Filter the raw title
    $title = apply_filters('bbp_raw_title', $title, $sep, $seplocation);
    // Compare new title with original title
    if ($title == $_title) {
        return $title;
    }
    // Temporary separator, for accurate flipping, if necessary
    $t_sep = '%WP_TITILE_SEP%';
    $prefix = '';
    if (!empty($title)) {
        $prefix = " {$sep} ";
    }
    // sep on right, so reverse the order
    if ('right' == $seplocation) {
        $title_array = explode($t_sep, $title);
        $title_array = array_reverse($title_array);
        $title = implode(" {$sep} ", $title_array) . $prefix;
        // sep on left, do not reverse
    } else {
        $title_array = explode($t_sep, $title);
//.........这里部分代码省略.........
开发者ID:rmccue,项目名称:bbPress,代码行数:101,代码来源:bbp-common-template.php

示例7: bbp_get_template_part

                <?php 
    bbp_get_template_part('form', 'search');
    ?>
            </div>
		</div>

	<?php 
}
?>

	<?php 
bbp_breadcrumb();
?>

	<?php 
if (bbp_is_topic_tag()) {
    bbp_topic_tag_description();
}
?>

	<?php 
do_action('bbp_template_before_topics_index');
?>

	<?php 
if (bbp_has_topics()) {
    ?>

		<?php 
    bbp_get_template_part('pagination', 'topics');
    ?>
开发者ID:aragonc,项目名称:3clicks,代码行数:31,代码来源:content-archive-topic.php

示例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;
 }
开发者ID:datracka,项目名称:datalook.io,代码行数:33,代码来源:bbpress.php

示例9: 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);
}
开发者ID:6226,项目名称:wp,代码行数:82,代码来源:function-breadcrumb.php

示例10: porto_breadcrumbs

function porto_breadcrumbs()
{
    // use yoast breadcrumbs if enabled
    if (function_exists('yoast_breadcrumb')) {
        $yoast_breadcrumbs = yoast_breadcrumb('', '', false);
        if ($yoast_breadcrumbs) {
            return $yoast_breadcrumbs;
        }
    }
    global $porto_settings;
    $post = isset($GLOBALS['post']) ? $GLOBALS['post'] : null;
    $output = '';
    // add breadcrumbs prefix
    if (!is_front_page()) {
        if (isset($porto_settings['breadcrumbs-prefix']) && $porto_settings['breadcrumbs-prefix']) {
            $output .= '<span class="breadcrumbs-prefix">' . $porto_settings['breadcrumbs-prefix'] . '</span>';
        }
    }
    // breadcrumbs start wrap
    $output .= '<ul class="breadcrumb">';
    // add home link
    if (!is_front_page()) {
        $output .= porto_breadcrumbs_link(__('Home', 'porto'), apply_filters('woocommerce_breadcrumb_home_url', home_url()));
    } elseif (is_home()) {
        $output .= porto_breadcrumbs_link($porto_settings['blog-title']);
    }
    // add woocommerce shop page link
    if (class_exists('WooCommerce') && (is_woocommerce() && is_archive() && !is_shop() || is_cart() || is_checkout() || is_account_page())) {
        $output .= porto_breadcrumbs_shop_link();
    }
    // add bbpress forums link
    if (class_exists('bbPress') && is_bbpress() && (bbp_is_topic_archive() || bbp_is_single_user() || bbp_is_search() || bbp_is_topic_tag() || bbp_is_edit())) {
        $output .= porto_breadcrumbs_link(bbp_get_forum_archive_title(), get_post_type_archive_link('forum'));
    }
    if (is_singular()) {
        if (isset($post->post_type) && get_post_type_archive_link($post->post_type) && (isset($porto_settings['breadcrumbs-archives-link']) && $porto_settings['breadcrumbs-archives-link'])) {
            $output .= porto_breadcrumbs_archive_link();
        } elseif (isset($post->post_type) && $post->post_type == 'post' && get_option('show_on_front') == 'page' && (isset($porto_settings['breadcrumbs-blog-link']) && $porto_settings['breadcrumbs-blog-link'])) {
            $output .= porto_breadcrumbs_link(get_the_title(get_option('page_for_posts', true)), get_permalink(get_option('page_for_posts')));
        }
        if (isset($post->post_parent) && $post->post_parent == 0) {
            $output .= porto_breadcrumbs_terms_link();
        } else {
            $output .= porto_breadcrumbs_ancestors_link();
        }
        $output .= porto_breadcrumb_leaf();
    } else {
        if (is_post_type_archive()) {
            if (is_search()) {
                $output .= porto_breadcrumbs_archive_link();
                $output .= porto_breadcrumb_leaf('search');
            } else {
                $output .= porto_breadcrumbs_archive_link(false);
            }
        } elseif (is_tax() || is_tag() || is_category()) {
            $html = porto_breadcrumbs_taxonomies_link();
            $html .= porto_breadcrumb_leaf('term');
            if (is_tag()) {
                if (get_option('show_on_front') == 'page' && (isset($porto_settings['breadcrumbs-blog-link']) && $porto_settings['breadcrumbs-blog-link'])) {
                    $output .= porto_breadcrumbs_link(get_the_title(get_option('page_for_posts', true)), get_permalink(get_option('page_for_posts')));
                }
                $output .= sprintf(__('Tag - %s', 'porto'), $html);
            } elseif (is_tax('product_tag')) {
                $output .= sprintf(__('Product Tag - %s', 'porto'), $html);
            } else {
                if (is_category() && get_option('show_on_front') == 'page' && (isset($porto_settings['breadcrumbs-blog-link']) && $porto_settings['breadcrumbs-blog-link'])) {
                    $output .= porto_breadcrumbs_link(get_the_title(get_option('page_for_posts', true)), get_permalink(get_option('page_for_posts')));
                }
                if (is_tax('portfolio_cat') || is_tax('portfolio_skills')) {
                    $output .= porto_breadcrumbs_link(porto_breadcrumbs_archive_name('portfolio'), get_post_type_archive_link('portfolio'));
                }
                if (is_tax('member_cat')) {
                    $output .= porto_breadcrumbs_link(porto_breadcrumbs_archive_name('member'), get_post_type_archive_link('member'));
                }
                if (is_tax('faq_cat')) {
                    $output .= porto_breadcrumbs_link(porto_breadcrumbs_archive_name('faq'), get_post_type_archive_link('faq'));
                }
                $output .= $html;
            }
        } elseif (is_date()) {
            global $wp_locale;
            if (get_option('show_on_front') == 'page' && (isset($porto_settings['breadcrumbs-blog-link']) && $porto_settings['breadcrumbs-blog-link'])) {
                $output .= porto_breadcrumbs_link(get_the_title(get_option('page_for_posts', true)), get_permalink(get_option('page_for_posts')));
            }
            $year = esc_html(get_query_var('year'));
            if (is_month() || is_day()) {
                $month = get_query_var('monthnum');
                $month_name = $wp_locale->get_month($month);
            }
            if (is_year()) {
                $output .= porto_breadcrumb_leaf('year');
            } elseif (is_month()) {
                $output .= porto_breadcrumbs_link($year, get_year_link($year));
                $output .= porto_breadcrumb_leaf('month');
            } elseif (is_day()) {
                $output .= porto_breadcrumbs_link($year, get_year_link($year));
                $output .= porto_breadcrumbs_link($month_name, get_month_link($year, $month));
                $output .= porto_breadcrumb_leaf('day');
            }
        } elseif (is_author()) {
//.........这里部分代码省略.........
开发者ID:booklein,项目名称:wpbookle,代码行数:101,代码来源:breadcrumbs.php

示例11: 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);
 }
开发者ID:pab44,项目名称:pab44,代码行数:11,代码来源:setup-bbpress.php

示例12: if

?>

<div id="bbpress-forums">

	<?php if ( bbp_allow_search() ) : ?>

		<div class="bbp-search-form">

			<?php bbp_get_template_part( 'form', 'search' ); ?>

		</div>

	<?php endif; ?>


	<?php if ( bbp_is_topic_tag() ) bbp_topic_tag_description(); ?>

	<?php do_action( 'bbp_template_before_topics_index' ); ?>

	<?php if ( bbp_has_topics() ) : ?>

		<?php bbp_get_template_part( 'pagination', 'topics'    ); ?>

		<?php bbp_get_template_part( 'loop',       'topics'    ); ?>

		<?php bbp_get_template_part( 'pagination', 'topics'    ); ?>

	<?php else : ?>

		<?php bbp_get_template_part( 'feedback',   'no-topics' ); ?>
开发者ID:niamherinoc,项目名称:rctractors,代码行数:30,代码来源:content-archive-topic.php

示例13: restrict_widget


//.........这里部分代码省略.........
                 } elseif (isset($instance['rw_opt']['devices_desktop'])) {
                     $found_device = false;
                 }
             } else {
                 if (isset($instance['rw_opt']['devices_desktop'], $instance['rw_opt']['devices_mobile']) || isset($instance['rw_opt']['devices_desktop'])) {
                     $found_device = true;
                 } elseif (isset($instance['rw_opt']['devices_mobile'])) {
                     $found_device = false;
                 }
             }
             if ($display_type === true) {
                 if ($found_device === true) {
                     $display_device = true;
                 } else {
                     $return = true;
                     $display_device = false;
                 }
             } else {
                 $display_device = $found_device === true ? false : true;
             }
         } else {
             $display_device = true;
         }
     }
     //others
     if ($return === false) {
         if (isset($instance['rw_opt']) && $this->is_widget_empty($instance['rw_opt'], 'main') === false) {
             $empty_main = false;
             if (is_front_page()) {
                 $found_main = isset($instance['rw_opt']['others_front_page']) ? true : false;
                 if (is_home() && $found_main == false) {
                     $found_main = isset($instance['rw_opt']['others_blog_page']) ? true : false;
                 }
             } elseif (is_home()) {
                 $found_main = isset($instance['rw_opt']['others_blog_page']) ? true : false;
             } elseif (is_singular()) {
                 if (is_page()) {
                     if (isset($instance['rw_opt']['cpt_' . get_post_type($post_id)])) {
                         $found_main = true;
                     } else {
                         $found_main = isset($instance['rw_opt']['pageid_' . $post_id]) ? true : false;
                     }
                 } else {
                     $found_main = isset($instance['rw_opt']['cpt_' . get_post_type($post_id)]) ? true : false;
                     if (is_single() && $found_main == false) {
                         $found_main = isset($instance['rw_opt']['others_single_post']) ? true : false;
                     }
                 }
             } elseif (is_post_type_archive()) {
                 $found_main = isset($instance['rw_opt']['cpta_' . get_query_var('post_type')]) ? true : false;
             } elseif (is_category()) {
                 $found_main = isset($instance['rw_opt']['category_' . get_query_var('cat')]) ? true : false;
             } elseif (is_tag()) {
                 if (($object = get_queried_object()) !== NULL && isset($object->taxonomy) && $object->taxonomy === 'post_tag') {
                     $tag = 'wp_log_type';
                 } else {
                     $tag = '';
                 }
                 $found_main = isset($instance['rw_opt']['taxonomy_' . $tag]) ? true : false;
             } elseif (is_tax()) {
                 $found_main = isset($instance['rw_opt']['taxonomy_' . get_query_var('taxonomy')]) ? true : false;
             } elseif (is_404()) {
                 $found_main = isset($instance['rw_opt']['others_404_page']) ? true : false;
             } elseif (is_sticky()) {
                 $found_main = isset($instance['rw_opt']['others_sticky_post']) ? true : false;
             } elseif (is_search()) {
                 $found_main = isset($instance['rw_opt']['others_search_page']) ? true : false;
             } elseif (is_author()) {
                 $found_main = isset($instance['rw_opt']['others_author_archive']) ? true : false;
             } elseif (is_date()) {
                 $found_main = isset($instance['rw_opt']['others_date_archive']) ? true : false;
             } elseif (function_exists('bbp_is_search') && bbp_is_search()) {
                 $found_main = isset($instance['rw_opt']['bbpress_search']) ? true : false;
             } elseif (function_exists('bbp_is_single_user') && bbp_is_single_user()) {
                 $found_main = isset($instance['rw_opt']['bbpress_single_user']) ? true : false;
             } elseif (function_exists('bbp_is_topic_tag') && bbp_is_topic_tag()) {
                 $found_main = isset($instance['rw_opt']['bbpress_topic_tag']) ? true : false;
             }
             $display_main = $display_type === true ? $found_main === true ? true : false : ($found_main === true ? false : true);
         } else {
             $display_main = true;
         }
     }
     if ($filter === false) {
         $instance = true;
     }
     if ($display_type === true) {
         $final_return = $display_lang === true && $display_user === true && $display_device === true && $display_main === true ? $instance : false;
     } else {
         $final_return = $empty_lang === false && $empty_user === false && $empty_device === false && $empty_main === false && $display_lang === false && $display_user === false && $display_device === false && $display_main === false || $empty_lang === false && $empty_user === false && $empty_device === false && $display_lang === false && $display_user === false && $display_device === false || $empty_lang === false && $empty_user === false && $empty_main === false && $display_lang === false && $display_user === false && $display_main === false || $empty_lang === false && $empty_device === false && $empty_main === false && $display_lang === false && $display_device === false && $display_main === false || $empty_user === false && $empty_device === false && $empty_main === false && $display_user === false && $display_device === false && $display_main === false || $empty_lang === false && $empty_user === false && $display_lang === false && $display_user === false || $empty_lang === false && $empty_device === false && $display_lang === false && $display_device === false || $empty_lang === false && $empty_main === false && $display_lang === false && $display_main === false || $empty_user === false && $empty_device === false && $display_user === false && $display_device === false || $empty_user === false && $empty_main === false && $display_user === false && $display_main === false || $empty_device === false && $empty_main === false && $display_device === false && $display_main === false || $empty_lang === false && $display_lang === false || $empty_user === false && $display_user === false || $empty_device === false && $display_device === false || $empty_main === false && $display_main === false ? false : $instance;
     }
     //filter true or false
     if ($filter === true) {
         $final_return = apply_filters_ref_array('rw_display_widget', array($final_return, $instance));
     }
     //if true return instance
     $final_return = $final_return === false ? false : $instance;
     //display: return $instance, hide: return false
     return $final_return;
 }
开发者ID:barkdesignchicago,项目名称:BHPN,代码行数:101,代码来源:restrict-widgets.php

示例14: hippo_title_text

 function hippo_title_text()
 {
     $query = get_queried_object();
     if (is_archive()) {
         if (is_day()) {
             $archive_title = get_the_time('d F, Y');
             $title = sprintf(esc_html__('Archive of: %s', 'monsoon'), $archive_title);
         } elseif (is_month()) {
             $archive_title = get_the_time('F Y');
             $title = sprintf(esc_html__('Archive of: %s', 'monsoon'), $archive_title);
         } elseif (is_year()) {
             $archive_title = get_the_time('Y');
             $title = sprintf(esc_html__('Archive of: %s', 'monsoon'), $archive_title);
         }
     }
     if (is_404()) {
         $title = esc_html__('404 Not Found', 'monsoon');
     }
     if (is_search()) {
         $title = sprintf(esc_html__('Search result for: "%s"', 'monsoon'), get_search_query());
     }
     if (function_exists('bbp_is_search') and bbp_is_search()) {
         $title = sprintf(esc_html__('Search result for: "%s"', 'monsoon'), get_search_query());
     }
     if (is_category()) {
         $title = sprintf(esc_html__('Category: %s', 'monsoon'), $query->name);
     }
     if (is_tag()) {
         $title = sprintf(esc_html__('Tag: %s', 'monsoon'), $query->name);
     }
     if (function_exists('bbp_is_topic_tag') and bbp_is_topic_tag()) {
         $title = sprintf(esc_html__('Tag: %s', 'monsoon'), $query->name);
     }
     if (is_author()) {
         $title = sprintf(esc_html__('Posts of: %s', 'monsoon'), $query->display_name);
     }
     if (is_page()) {
         $title = esc_html($query->post_title);
     }
     if (is_home() or is_single()) {
         $title = esc_html(hippo_option('blog-title'));
     }
     if (is_singular('service')) {
         $title = esc_html(get_the_title());
     }
     if (is_singular('portfolio')) {
         $title = esc_html(get_the_title());
     }
     if (is_tax('portfolio-type')) {
         $title = sprintf(esc_html__('%s', 'monsoon'), $query->name);
     }
     if (is_singular('team')) {
         $title = esc_html(get_the_title());
     }
     if (is_singular('forum')) {
         $title = esc_html(get_the_title());
     }
     if (is_singular('topic')) {
         $title = esc_html(get_the_title());
     }
     if (is_singular('product')) {
         $title = esc_html(get_the_title());
     }
     if (is_post_type_archive('product')) {
         $title = esc_html(post_type_archive_title('', FALSE));
     }
     if (is_post_type_archive('forum')) {
         $title = esc_html(post_type_archive_title('', FALSE));
     }
     if (is_post_type_archive('topic')) {
         $title = esc_html(post_type_archive_title('', FALSE));
     }
     if (function_exists('bbp_is_single_user') and bbp_is_single_user()) {
         $title = esc_html(get_the_title());
     }
     if (function_exists('bbp_is_reply_edit') and bbp_is_reply_edit()) {
         $title = esc_html(get_the_title());
     }
     if (class_exists('WooCommerce')) {
         if (is_product_category()) {
             $title = sprintf(esc_html__('%s', 'monsoon'), $query->name);
         }
         if (is_product_tag()) {
             $title = sprintf(esc_html__('%s', 'monsoon'), $query->name);
         }
     }
     $title = apply_filters('hippo_title_text', $title, $title);
     if (empty($title)) {
         $title = esc_html(get_bloginfo('name'));
     }
     return $title;
 }
开发者ID:estrategasdigitales,项目名称:flazam,代码行数:92,代码来源:template-tags.php

示例15: 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_topic_split() || bbp_is_topic_merge() || 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()) {
        // 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'));
        // Topc Tag
    } elseif (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()) {
//.........这里部分代码省略.........
开发者ID:rmccue,项目名称:bbPress,代码行数:101,代码来源:bbp-theme-compatibility.php


注:本文中的bbp_is_topic_tag函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。