• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP bbp_get_search_rewrite_id函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: bbp_get_search_terms

/**
 * Get the search terms
 *
 * @since bbPress (r4579)
 *
 * If search terms are supplied, those are used. Otherwise check the
 * search rewrite id query var.
 *
 * @param string $passed_terms Optional. Search terms
 * @uses sanitize_title() To sanitize the search terms
 * @uses get_query_var() To get the search terms from query variable
 * @return bool|string Search terms on success, false on failure
 */
function bbp_get_search_terms($passed_terms = '')
{
    // Sanitize terms if they were passed in
    if (!empty($passed_terms)) {
        $search_terms = sanitize_title($passed_terms);
        // Use query variable if not
    } else {
        $search_terms = get_query_var(bbp_get_search_rewrite_id());
    }
    // Trim whitespace and decode, or set explicitly to false if empty
    $search_terms = !empty($search_terms) ? urldecode(trim($search_terms)) : false;
    return apply_filters('bbp_get_search_terms', $search_terms, $passed_terms);
}
开发者ID:danielcoats,项目名称:schoolpress,代码行数:26,代码来源:template.php


示例2: bbp_breadcrumb

/**
 * Search Content Part
 *
 * @package bbPress
 * @subpackage Theme
 */
?>

<div id="bbpress-forums">

	<?php 
bbp_breadcrumb();
?>

	<?php 
bbp_set_query_name(bbp_get_search_rewrite_id());
?>

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

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

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

		 <?php 
开发者ID:6226,项目名称:wp,代码行数:31,代码来源:content-search.php


示例3: bbp_is_search_results

/**
 * Check if current page is a search results page
 *
 * @since bbPress (r4919)
 *
 * @global WP_Query $wp_query To check if WP_Query::bbp_is_search is true
 * @uses bbp_is_query_name() To get the query name
 * @return bool Is it a search page?
 */
function bbp_is_search_results()
{
    global $wp_query;
    // Bail if search is disabled
    if (!bbp_allow_search()) {
        return false;
    }
    // Assume false
    $retval = false;
    // Check query
    if (!empty($wp_query->bbp_search_terms)) {
        $retval = true;
    }
    // Check query name
    if (empty($retval) && bbp_is_query_name('bbp_search_results')) {
        $retval = true;
    }
    // Check $_REQUEST
    if (empty($retval) && !empty($_REQUEST[bbp_get_search_rewrite_id()])) {
        $retval = true;
    }
    return (bool) apply_filters('bbp_is_search_results', $retval);
}
开发者ID:danielcoats,项目名称:schoolpress,代码行数:32,代码来源:template.php


示例4: add_permastructs

 /**
  * Add permalink structures for new archive-style destinations.
  *
  * - Users
  * - Topic Views
  * - Search
  *
  * @since bbPress (r4930)
  */
 public static function add_permastructs()
 {
     // Get unique ID's
     $user_id = bbp_get_user_rewrite_id();
     $view_id = bbp_get_view_rewrite_id();
     $search_id = bbp_get_search_rewrite_id();
     // Get root slugs
     $user_slug = bbp_get_user_slug();
     $view_slug = bbp_get_view_slug();
     $search_slug = bbp_get_search_slug();
     // User Permastruct
     add_permastruct($user_id, $user_slug . '/%' . $user_id . '%', array('with_front' => false, 'ep_mask' => EP_NONE, 'paged' => false, 'feed' => false, 'forcomments' => false, 'walk_dirs' => true, 'endpoints' => false));
     // Topic View Permastruct
     add_permastruct($view_id, $view_slug . '/%' . $view_id . '%', array('with_front' => false, 'ep_mask' => EP_NONE, 'paged' => false, 'feed' => false, 'forcomments' => false, 'walk_dirs' => true, 'endpoints' => false));
     // Search Permastruct
     add_permastruct($user_id, $search_slug . '/%' . $search_id . '%', array('with_front' => false, 'ep_mask' => EP_NONE, 'paged' => true, 'feed' => false, 'forcomments' => false, 'walk_dirs' => true, 'endpoints' => false));
 }
开发者ID:jenia-buianov,项目名称:all_my_sites,代码行数:26,代码来源:bbpress.php


示例5: bbp_parse_query


//.........这里部分代码省略.........
            // Editing a user
            $posts_query->bbp_is_edit = true;
            // User favorites
        } elseif (!empty($is_favs)) {
            $posts_query->bbp_is_single_user_favs = true;
            // User subscriptions
        } elseif (!empty($is_subs)) {
            $posts_query->bbp_is_single_user_subs = true;
            // User topics
        } elseif (!empty($is_topics)) {
            $posts_query->bbp_is_single_user_topics = true;
            // User topics
        } elseif (!empty($is_replies)) {
            $posts_query->bbp_is_single_user_replies = true;
            // User profile
        } else {
            $posts_query->bbp_is_single_user_profile = true;
        }
        // Looking at a single user
        $posts_query->bbp_is_single_user = true;
        // Make sure 404 is not set
        $posts_query->is_404 = false;
        // Correct is_home variable
        $posts_query->is_home = false;
        // User is looking at their own profile
        if (get_current_user_id() === $the_user->ID) {
            $posts_query->bbp_is_single_user_home = true;
        }
        // Set bbp_user_id for future reference
        $posts_query->set('bbp_user_id', $the_user->ID);
        // Set author_name as current user's nicename to get correct posts
        $posts_query->set('author_name', $the_user->user_nicename);
        // Set the displayed user global to this user
        bbpress()->displayed_user = $the_user;
        // View Page
    } elseif (!empty($bbp_view)) {
        // Check if the view exists by checking if there are query args are set
        $view_args = bbp_get_view_query_args($bbp_view);
        // Bail if view args is false (view isn't registered)
        if (false === $view_args) {
            $posts_query->set_404();
            return;
        }
        // Correct is_home variable
        $posts_query->is_home = false;
        // We are in a custom topic view
        $posts_query->bbp_is_view = true;
        // Search Page
    } elseif (isset($posts_query->query_vars[bbp_get_search_rewrite_id()])) {
        // Check if there are search query args set
        $search_terms = bbp_get_search_terms();
        if (!empty($search_terms)) {
            $posts_query->bbp_search_terms = $search_terms;
        }
        // Correct is_home variable
        $posts_query->is_home = false;
        // We are in a search query
        $posts_query->bbp_is_search = true;
        // Forum/Topic/Reply Edit Page
    } elseif (!empty($is_edit)) {
        // Get the post type from the main query loop
        $post_type = $posts_query->get('post_type');
        // Check which post_type we are editing, if any
        if (!empty($post_type)) {
            switch ($post_type) {
                // We are editing a forum
                case bbp_get_forum_post_type():
                    $posts_query->bbp_is_forum_edit = true;
                    $posts_query->bbp_is_edit = true;
                    break;
                    // We are editing a topic
                // We are editing a topic
                case bbp_get_topic_post_type():
                    $posts_query->bbp_is_topic_edit = true;
                    $posts_query->bbp_is_edit = true;
                    break;
                    // We are editing a reply
                // We are editing a reply
                case bbp_get_reply_post_type():
                    $posts_query->bbp_is_reply_edit = true;
                    $posts_query->bbp_is_edit = true;
                    break;
            }
            // We are editing a topic tag
        } elseif (bbp_is_topic_tag()) {
            $posts_query->bbp_is_topic_tag_edit = true;
            $posts_query->bbp_is_edit = true;
        }
        // We save post revisions on our own
        remove_action('pre_post_update', 'wp_save_post_revision');
        // Topic tag page
    } elseif (bbp_is_topic_tag()) {
        $posts_query->set('bbp_topic_tag', get_query_var('term'));
        $posts_query->set('post_type', bbp_get_topic_post_type());
        $posts_query->set('posts_per_page', bbp_get_topics_per_page());
        // Do topics on forums root
    } elseif (is_post_type_archive(array(bbp_get_forum_post_type(), bbp_get_topic_post_type())) && 'topics' === bbp_show_on_root()) {
        $posts_query->bbp_show_topics_on_root = true;
    }
}
开发者ID:donwea,项目名称:nhap.org,代码行数:101,代码来源:template-functions.php


示例6: bbp_template_include_theme_compat


//.........这里部分代码省略.........
        } else {
            $new_title = apply_filters('the_title', $page->post_title);
        }
        // Reset post
        bbp_theme_compat_reset_post(array('ID' => !empty($page->ID) ? $page->ID : 0, 'post_title' => bbp_get_topic_archive_title(), 'post_author' => 0, 'post_date' => 0, 'post_content' => $new_content, 'post_type' => bbp_get_topic_post_type(), 'post_status' => bbp_get_public_status_id(), 'is_archive' => true, 'comment_status' => 'closed'));
        // Single Topic
    } elseif (bbp_is_topic_edit() || bbp_is_single_topic()) {
        // Split
        if (bbp_is_topic_split()) {
            $new_content = bbp_buffer_template_part('form', 'topic-split', false);
            // Merge
        } elseif (bbp_is_topic_merge()) {
            $new_content = bbp_buffer_template_part('form', 'topic-merge', false);
            // Edit
        } elseif (bbp_is_topic_edit()) {
            $new_content = $bbp_shortcodes->display_topic_form();
            // Single
        } else {
            $new_content = $bbp_shortcodes->display_topic(array('id' => bbp_get_topic_id()));
        }
        // Reset post
        bbp_theme_compat_reset_post(array('ID' => bbp_get_topic_id(), 'post_title' => bbp_get_topic_title(), 'post_author' => bbp_get_topic_author_id(), 'post_date' => 0, 'post_content' => $new_content, 'post_type' => bbp_get_topic_post_type(), 'post_status' => bbp_get_topic_status(), 'is_single' => true, 'comment_status' => 'closed'));
        /** Replies ***********************************************************/
        // Reply archive
    } elseif (is_post_type_archive(bbp_get_reply_post_type())) {
        // Reset post
        bbp_theme_compat_reset_post(array('ID' => 0, 'post_title' => __('Replies', 'bbpress'), 'post_author' => 0, 'post_date' => 0, 'post_content' => $bbp_shortcodes->display_reply_index(), 'post_type' => bbp_get_reply_post_type(), 'post_status' => bbp_get_public_status_id(), 'comment_status' => 'closed'));
        // Single Reply
    } elseif (bbp_is_reply_edit() || bbp_is_single_reply()) {
        // Move
        if (bbp_is_reply_move()) {
            $new_content = bbp_buffer_template_part('form', 'reply-move', false);
            // Edit
        } elseif (bbp_is_reply_edit()) {
            $new_content = $bbp_shortcodes->display_reply_form();
            // Single
        } else {
            $new_content = $bbp_shortcodes->display_reply(array('id' => get_the_ID()));
        }
        // Reset post
        bbp_theme_compat_reset_post(array('ID' => bbp_get_reply_id(), 'post_title' => bbp_get_reply_title(), 'post_author' => bbp_get_reply_author_id(), 'post_date' => 0, 'post_content' => $new_content, 'post_type' => bbp_get_reply_post_type(), 'post_status' => bbp_get_reply_status(), 'comment_status' => 'closed'));
        /** Views *************************************************************/
    } elseif (bbp_is_single_view()) {
        // Reset post
        bbp_theme_compat_reset_post(array('ID' => 0, 'post_title' => bbp_get_view_title(), 'post_author' => 0, 'post_date' => 0, 'post_content' => $bbp_shortcodes->display_view(array('id' => get_query_var(bbp_get_view_rewrite_id()))), 'post_type' => '', 'post_status' => bbp_get_public_status_id(), 'comment_status' => 'closed'));
        /** Search ************************************************************/
    } elseif (bbp_is_search()) {
        // Reset post
        bbp_theme_compat_reset_post(array('ID' => 0, 'post_title' => bbp_get_search_title(), 'post_author' => 0, 'post_date' => 0, 'post_content' => $bbp_shortcodes->display_search(array('search' => get_query_var(bbp_get_search_rewrite_id()))), 'post_type' => '', 'post_status' => bbp_get_public_status_id(), 'comment_status' => 'closed'));
        /** Topic Tags ********************************************************/
        // Topic Tag Edit
    } elseif (bbp_is_topic_tag_edit() || bbp_is_topic_tag()) {
        // Stash the current term in a new var
        set_query_var('bbp_topic_tag', get_query_var('term'));
        // Show topics of tag
        if (bbp_is_topic_tag()) {
            $new_content = $bbp_shortcodes->display_topics_of_tag(array('id' => bbp_get_topic_tag_id()));
            // Edit topic tag
        } elseif (bbp_is_topic_tag_edit()) {
            $new_content = $bbp_shortcodes->display_topic_tag_form();
        }
        // Reset the post with our new title
        bbp_theme_compat_reset_post(array('ID' => 0, 'post_author' => 0, 'post_date' => 0, 'post_content' => $new_content, 'post_type' => '', 'post_title' => sprintf(__('Topic Tag: %s', 'bbpress'), '<span>' . bbp_get_topic_tag_name() . '</span>'), 'post_status' => bbp_get_public_status_id(), 'comment_status' => 'closed', 'is_tax' => true));
    }
    /**
     * Bail if the template already matches a bbPress template. This includes
     * archive-* and single-* WordPress post_type matches (allowing
     * themes to use the expected format) as well as all bbPress-specific
     * template files for users, topics, forums, etc...
     *
     * We do this after the above checks to prevent incorrect 404 body classes
     * and header statuses, as well as to set the post global as needed.
     *
     * @see https://bbpress.trac.wordpress.org/ticket/1478/
     */
    if (bbp_is_template_included()) {
        return $template;
        /**
         * If we are relying on bbPress's built in theme compatibility to load
         * the proper content, we need to intercept the_content, replace the
         * output, and display ours instead.
         *
         * To do this, we first remove all filters from 'the_content' and hook
         * our own function into it, which runs a series of checks to determine
         * the context, and then uses the built in shortcodes to output the
         * correct results from inside an output buffer.
         *
         * Uses bbp_get_theme_compat_templates() to provide fall-backs that
         * should be coded without superfluous mark-up and logic (prev/next
         * navigation, comments, date/time, etc...)
         *
         * Hook into the 'bbp_get_bbpress_template' to override the array of
         * possible templates, or 'bbp_bbpress_template' to override the result.
         */
    } elseif (bbp_is_theme_compat_active()) {
        bbp_remove_all_filters('the_content');
        $template = bbp_get_theme_compat_templates();
    }
    return apply_filters('bbp_template_include_theme_compat', $template);
}
开发者ID:joeyblake,项目名称:bbpress,代码行数:101,代码来源:theme-compat.php


示例7: display_search

 /**
  * Display the contents of search results in an output buffer and return to
  * ensure that post/page contents are displayed first.
  *
  * @since bbPress (r4579)
  *
  * @param array $attr
  * @param string $content
  * @uses bbp_search_query()
  * @uses get_template_part()
  */
 public function display_search($attr, $content = '')
 {
     // Sanity check required info
     if (!empty($content)) {
         return $content;
     }
     // Bail if search is disabled
     if (!bbp_allow_search()) {
         return;
     }
     // Trim search attribute if it's set
     if (isset($attr['search'])) {
         $attr['search'] = trim($attr['search']);
     }
     // Set passed attribute to $search_terms for clarity
     $search_terms = empty($attr['search']) ? bbp_get_search_terms() : $attr['search'];
     // Unset globals
     $this->unset_globals();
     // Set terms for query
     set_query_var(bbp_get_search_rewrite_id(), $search_terms);
     // Start output buffer
     $this->start(bbp_get_search_rewrite_id());
     // Output template
     bbp_get_template_part('content', 'search');
     // Return contents of output buffer
     return $this->end();
 }
开发者ID:danielcoats,项目名称:schoolpress,代码行数:38,代码来源:shortcodes.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP bbp_get_search_terms函数代码示例发布时间:2022-05-24
下一篇:
PHP bbp_get_sanitize_val函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap