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


PHP bbp_get_topic_tag_slug函数代码示例

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


在下文中一共展示了bbp_get_topic_tag_slug函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: bbp_topic_tag_slug

/**
 * Output the slug of the current tag
 *
 * @since 2.0.0 bbPress (r3109)
 *
 * @uses bbp_get_topic_tag_slug()
 */
function bbp_topic_tag_slug($tag = '')
{
    echo bbp_get_topic_tag_slug($tag);
}
开发者ID:joeyblake,项目名称:bbpress,代码行数:11,代码来源:template.php

示例2: esc_attr

" value="<?php 
    echo esc_attr(bbp_get_topic_tag_name());
    ?>
" />
				</p>

				<p>
					<label for="tag-slug"><?php 
    _e('Slug:', 'bbpress');
    ?>
</label>
					<input type="text" id="tag-slug" name="tag-slug" size="20" maxlength="40" tabindex="<?php 
    bbp_tab_index();
    ?>
" value="<?php 
    echo esc_attr(apply_filters('editable_slug', bbp_get_topic_tag_slug()));
    ?>
" />
				</p>

				<div class="bbp-submit-wrapper">
					<button type="submit" tabindex="<?php 
    bbp_tab_index();
    ?>
" class="button submit"><?php 
    esc_attr_e('Update', 'bbpress');
    ?>
</button>

					<input type="hidden" name="tag-id" value="<?php 
    bbp_topic_tag_id();
开发者ID:skywindzz,项目名称:blue_leopard,代码行数:31,代码来源:form-topic-tag.php

示例3: bbp_get_topic_tag_edit_template

/**
 * Get the topic edit template
 *
 * @since bbPress (r3311)
 *
 * @uses bbp_get_topic_tag_tax_id()
 * @uses bbp_get_query_template()
 * @return string Path to template file
 */
function bbp_get_topic_tag_edit_template()
{
    $tt_slug = bbp_get_topic_tag_slug();
    $tt_id = bbp_get_topic_tag_tax_id();
    $templates = array('taxonomy-' . $tt_slug . '-edit.php', 'taxonomy-' . $tt_id . '-edit.php');
    return bbp_get_query_template('topic_tag_edit', $templates);
}
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:16,代码来源:template-loader.php

示例4: bbp_body_class

/**
 * Use the above is_() functions to output a body class for each scenario
 *
 * @since bbPress (r2926)
 *
 * @param array $wp_classes
 * @param array $custom_classes
 * @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()
 * @uses bbp_is_forum_archive()
 * @uses bbp_is_topic_archive()
 * @uses bbp_is_topic_tag()
 * @uses bbp_is_topic_tag_edit()
 * @uses bbp_get_topic_tag_tax_id()
 * @uses bbp_get_topic_tag_slug()
 * @uses bbp_get_topic_tag_id()
 * @return array Body Classes
 */
function bbp_body_class($wp_classes, $custom_classes = false)
{
    $bbp_classes = array();
    /** Archives **************************************************************/
    if (bbp_is_forum_archive()) {
        $bbp_classes[] = bbp_get_forum_post_type() . '-archive';
    }
    if (bbp_is_topic_archive()) {
        $bbp_classes[] = bbp_get_topic_post_type() . '-archive';
    }
    /** Topic Tags ************************************************************/
    if (bbp_is_topic_tag()) {
        $bbp_classes[] = bbp_get_topic_tag_tax_id();
        $bbp_classes[] = bbp_get_topic_tag_tax_id() . '-' . bbp_get_topic_tag_slug();
        $bbp_classes[] = bbp_get_topic_tag_tax_id() . '-' . bbp_get_topic_tag_id();
    }
    if (bbp_is_topic_tag_edit()) {
        $bbp_classes[] = bbp_get_topic_tag_tax_id() . '-edit';
        $bbp_classes[] = bbp_get_topic_tag_tax_id() . '-' . bbp_get_topic_tag_slug() . '-edit';
        $bbp_classes[] = bbp_get_topic_tag_tax_id() . '-' . bbp_get_topic_tag_id() . '-edit';
    }
    /** Components ************************************************************/
    if (bbp_is_single_forum()) {
        $bbp_classes[] = bbp_get_forum_post_type();
    }
    if (bbp_is_single_topic()) {
        $bbp_classes[] = bbp_get_topic_post_type();
    }
    if (bbp_is_single_reply()) {
        $bbp_classes[] = bbp_get_reply_post_type();
    }
    if (bbp_is_topic_edit()) {
        $bbp_classes[] = bbp_get_topic_post_type() . '-edit';
    }
    if (bbp_is_topic_merge()) {
        $bbp_classes[] = bbp_get_topic_post_type() . '-merge';
    }
    if (bbp_is_topic_split()) {
        $bbp_classes[] = bbp_get_topic_post_type() . '-split';
    }
    if (bbp_is_reply_edit()) {
        $bbp_classes[] = bbp_get_reply_post_type() . '-edit';
    }
    if (bbp_is_single_view()) {
        $bbp_classes[] = 'bbp-view';
    }
    /** User ******************************************************************/
    if (bbp_is_single_user_edit()) {
        $bbp_classes[] = 'bbp-user-edit';
        $bbp_classes[] = 'single';
        $bbp_classes[] = 'singular';
    }
    if (bbp_is_single_user()) {
        $bbp_classes[] = 'bbp-user-page';
        $bbp_classes[] = 'single';
        $bbp_classes[] = 'singular';
    }
    if (bbp_is_user_home()) {
        $bbp_classes[] = 'bbp-user-home';
        $bbp_classes[] = 'single';
        $bbp_classes[] = 'singular';
    }
    if (bbp_is_user_home_edit()) {
        $bbp_classes[] = 'bbp-user-home-edit';
        $bbp_classes[] = 'single';
        $bbp_classes[] = 'singular';
    }
    if (bbp_is_topics_created()) {
        $bbp_classes[] = 'bbp-topics-created';
//.........这里部分代码省略.........
开发者ID:rmccue,项目名称:bbPress,代码行数:101,代码来源:bbp-common-template.php

示例5: tehnik_bbp_has_topics

function tehnik_bbp_has_topics($args = '')
{
    global $wp_rewrite;
    /** 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', '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);
    //Get an array of IDs which the current user has permissions to view
    $allowed_forums = tehnik_bpp_get_permitted_post_ids(new WP_Query($default));
    // The default forum query with allowed forum ids array added
    $default['post__in'] = $allowed_forums;
    // 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());
        // 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'] = join(',', $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];
                    // Remove sticky from current position
                    array_splice($bbp->topic_query->posts, $post_offset, 1);
                    // Move to front, after other stickies
                    array_splice($bbp->topic_query->posts, $sticky_offset, 0, array($sticky));
                    // Cleanup
                    unset($stickies[$sticky_index]);
                    unset($sticky);
                }
                // Cleanup
                unset($post_offsets);
            }
            // Cleanup
            unset($sticky_offset);
            // If any posts have been excluded specifically, Ignore those that are sticky.
            if (!empty($stickies) && !empty($r['post__not_in'])) {
                $stickies = array_diff($stickies, $r['post__not_in']);
            }
            // Fetch sticky posts that weren't in the query results
            if (!empty($stickies)) {
                // Query to use in get_posts to get sticky posts
                $sticky_query = array('post_type' => bbp_get_topic_post_type(), 'post_parent' => 'any', 'meta_key' => '_bbp_last_active_time', 'orderby' => 'meta_value', 'order' => 'DESC', 'include' => $stickies);
                //Get an array of IDs which the current user has permissions to view
                $allowed_forums = tehnik_bpp_get_permitted_post_ids(new WP_Query($sticky_query));
                // The default forum query with allowed forum ids array added
                $sticky_query['post__in'] = $allowed_forums;
//.........这里部分代码省略.........
开发者ID:dnaleor,项目名称:Tehnik-bbPress-Permissions,代码行数:101,代码来源:tehnik_bpp_forum_widgets.php

示例6: pg_get_user_unread

function pg_get_user_unread($user_id = 0)
{
    // Default to the displayed user
    $user_id = bbp_get_user_id($user_id);
    if (empty($user_id)) {
        return false;
    }
    // If user has unread topics, load them
    $read_ids = (string) get_user_meta($user_id, '_bbp_mar_read_ids', true);
    $read_ids = (array) explode(',', $read_ids);
    $read_ids = array_filter($read_ids);
    if (!empty($read_ids)) {
        //so we have unreads, so need to create a list of unread that the user can see
        //so first we create a list of topics the user can see
        global $wpdb;
        $topic = bbp_get_topic_post_type();
        $post_ids = $wpdb->get_col("select ID from {$wpdb->posts} where post_type = '{$topic}'");
        //check this list against those the user is allowed to see, and create a list of valid ones for the wp_query in bbp_has_topics
        $allowed_posts = check_private_groups_topic_ids($post_ids);
        //now we need to take out of that list all read topics for that user
        foreach ($read_ids as $read_id) {
            if (($key = array_search($read_id, $allowed_posts)) !== false) {
                unset($allowed_posts[$key]);
            }
        }
        //so now we have an allowed list that has only topics the user can see, but not topics the user has read
        //now we use the code from bbp_has_topics to run the list - we can't call it as PG already filters the original function
        global $wp_rewrite;
        /** 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', '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, 'post__in' => $allowed_posts);
        // 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());
            // 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
        //stopped to prevent parsing
        //$r = bbp_parse_args( $args, $default, 'has_topics' );
        // Get bbPress
        $bbp = bbpress();
        // Call the query
        //now query the original default
        $bbp->topic_query = new WP_Query($default);
        // 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];
                        // Remove sticky from current position
                        array_splice($bbp->topic_query->posts, $post_offset, 1);
//.........这里部分代码省略.........
开发者ID:USSLomaPrieta,项目名称:usslomaprieta.org,代码行数:101,代码来源:mark-as-read-filter.php


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