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


PHP bp_theme_compat_reset_post函数代码示例

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


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

示例1: dummy_post

 /**
  * Update the global $post with dummy data
  *
  * @since BuddyPress (1.7)
  */
 public function dummy_post()
 {
     // Registration page
     if (mpp_is_gallery_directory()) {
         $title = __('Gallery Directory', 'mediapress');
     }
     bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => bp_get_directory_title('mediapress'), 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => mpp_get_gallery_post_type(), 'post_status' => 'publish', 'is_page' => true, 'comment_status' => 'closed'));
 }
开发者ID:markc,项目名称:mediapress,代码行数:13,代码来源:mpp-theme-compat.php

示例2: create_dummy_post

 /**
  * Update the global $post with create screen data.
  *
  * @since BuddyPress (1.7.0)
  */
 public function create_dummy_post()
 {
     // Title based on ability to create blogs
     if (is_user_logged_in() && bp_blog_signup_enabled()) {
         $title = '<a class="button bp-title-button" href="' . trailingslashit(bp_get_root_domain() . '/' . bp_get_blogs_root_slug()) . '">' . __('Sites', 'buddypress') . '</a>&nbsp;' . __('Create a Site', 'buddypress');
     } else {
         $title = __('Sites', 'buddypress');
     }
     bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => $title, 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => 'page', 'post_status' => 'publish', 'is_page' => true, 'comment_status' => 'closed'));
 }
开发者ID:eresyyl,项目名称:mk,代码行数:15,代码来源:bp-blogs-screens.php

示例3: single_dummy_post

 /**
  * Update the global $post with single group data.
  *
  * @since 1.7.0
  */
 public function single_dummy_post()
 {
     bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => bp_get_current_group_name(), 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => 'page', 'post_status' => 'publish', 'is_page' => true, 'comment_status' => 'closed'));
 }
开发者ID:swissspidy,项目名称:BuddyPress,代码行数:9,代码来源:bp-groups-screens.php

示例4: bp_core_load_template

/**
 * Load a specific template file with fallback support.
 *
 * Example:
 *   bp_core_load_template( 'members/index' );
 * Loads:
 *   wp-content/themes/[activated_theme]/members/index.php
 *
 * @param array $templates Array of templates to attempt to load.
 */
function bp_core_load_template($templates)
{
    global $wp_query;
    // Reset the post.
    bp_theme_compat_reset_post(array('ID' => 0, 'is_404' => true, 'post_status' => 'publish'));
    // Set theme compat to false since the reset post function automatically sets
    // theme compat to true.
    bp_set_theme_compat_active(false);
    // Fetch each template and add the php suffix.
    $filtered_templates = array();
    foreach ((array) $templates as $template) {
        $filtered_templates[] = $template . '.php';
    }
    // Only perform template lookup for bp-default themes.
    if (!bp_use_theme_compat_with_current_theme()) {
        $template = locate_template((array) $filtered_templates, false);
        // Theme compat doesn't require a template lookup.
    } else {
        $template = '';
    }
    /**
     * Filters the template locations.
     *
     * Allows plugins to alter where the template files are located.
     *
     * @since 1.1.0
     *
     * @param string $template           Located template path.
     * @param array  $filtered_templates Array of templates to attempt to load.
     */
    $located_template = apply_filters('bp_located_template', $template, $filtered_templates);
    if (!empty($located_template)) {
        // Template was located, lets set this as a valid page and not a 404.
        status_header(200);
        $wp_query->is_page = true;
        $wp_query->is_singular = true;
        $wp_query->is_404 = false;
        /**
         * Fires before the loading of a located template file.
         *
         * @since 1.6.0
         *
         * @param string $located_template Template found to be loaded.
         */
        do_action('bp_core_pre_load_template', $located_template);
        /**
         * Filters the selected template right before loading.
         *
         * @since 1.1.0
         *
         * @param string $located_template Template found to be loaded.
         */
        load_template(apply_filters('bp_load_template', $located_template));
        /**
         * Fires after the loading of a located template file.
         *
         * @since 1.6.0
         *
         * @param string $located_template Template found that was loaded.
         */
        do_action('bp_core_post_load_template', $located_template);
        // Kill any other output after this.
        exit;
        // No template found, so setup theme compatibility.
        // @todo Some other 404 handling if theme compat doesn't kick in.
    } else {
        // We know where we are, so reset important $wp_query bits here early.
        // The rest will be done by bp_theme_compat_reset_post() later.
        if (is_buddypress()) {
            status_header(200);
            $wp_query->is_page = true;
            $wp_query->is_singular = true;
            $wp_query->is_404 = false;
        }
        /**
         * Fires if there are no found templates to load and theme compat is needed.
         *
         * @since 1.7.0
         */
        do_action('bp_setup_theme_compat');
    }
}
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:92,代码来源:bp-core-catchuri.php

示例5: buatp_dummy_post

function buatp_dummy_post()
{
    bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => __('', 'buddypress'), 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => 'bp_members', 'post_status' => 'publish', 'is_archive' => true, 'comment_status' => 'closed'));
}
开发者ID:jfeliweb,项目名称:BuddyPress-User-Account-Type,代码行数:4,代码来源:bp-user-type-template.php

示例6: directory_dummy_post

 /**
  * Update the global $post with directory data
  *
  * @package BuddyDrive Component
  * @subpackage Screens
  * @since 1.2.0
  *
  * @uses bp_theme_compat_reset_post() to reset the post data
  */
 public function directory_dummy_post()
 {
     bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => buddydrive_get_name(), 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => 'page', 'post_status' => 'publish', 'is_page' => true, 'comment_status' => 'closed'));
 }
开发者ID:MrVibe,项目名称:buddydrive,代码行数:13,代码来源:buddydrive-item-screens.php

示例7: bp_core_load_template

/**
 * Load a specific template file with fallback support.
 *
 * Example:
 *   bp_core_load_template( 'members/index' );
 * Loads:
 *   wp-content/themes/[activated_theme]/members/index.php
 *
 * @param array $templates Array of templates to attempt to load.
 * @return bool|null Returns false on failure.
 */
function bp_core_load_template($templates)
{
    global $wp_query;
    // check if BP page belongs to, or is a child of, a BP directory page
    $page_id = false;
    foreach ((array) buddypress()->pages as $page) {
        if ($page->name == buddypress()->unfiltered_uri[buddypress()->unfiltered_uri_offset]) {
            $page_id = $page->id;
            break;
        }
    }
    // Set up reset post args
    $reset_post_args = array('is_404' => true, 'post_status' => 'publish');
    // BP page exists - fill in the $wp_query->post object
    //
    // bp_theme_compat_reset_post() looks at the $wp_query->post object to fill in
    // the post globals
    if (!empty($page_id)) {
        $wp_query->post = get_post($page_id);
        $reset_post_args['ID'] = $page_id;
    } else {
        $reset_post_args['ID'] = 0;
    }
    // Reset the post
    bp_theme_compat_reset_post($reset_post_args);
    // Set theme compat to false since the reset post function automatically sets
    // theme compat to true
    bp_set_theme_compat_active(false);
    // Fetch each template and add the php suffix
    $filtered_templates = array();
    foreach ((array) $templates as $template) {
        $filtered_templates[] = $template . '.php';
    }
    // Only perform template lookup for bp-default themes
    if (!bp_use_theme_compat_with_current_theme()) {
        $template = locate_template((array) $filtered_templates, false);
        // Theme compat doesn't require a template lookup
    } else {
        $template = '';
    }
    // Filter the template locations so that plugins can alter where they are located
    $located_template = apply_filters('bp_located_template', $template, $filtered_templates);
    if (!empty($located_template)) {
        // Template was located, lets set this as a valid page and not a 404.
        status_header(200);
        $wp_query->is_page = true;
        $wp_query->is_singular = true;
        $wp_query->is_404 = false;
        do_action('bp_core_pre_load_template', $located_template);
        load_template(apply_filters('bp_load_template', $located_template));
        do_action('bp_core_post_load_template', $located_template);
        // Kill any other output after this.
        exit;
        // No template found, so setup theme compatability
        // @todo Some other 404 handling if theme compat doesn't kick in
    } else {
        // We know where we are, so reset important $wp_query bits here early.
        // The rest will be done by bp_theme_compat_reset_post() later.
        if (is_buddypress()) {
            status_header(200);
            $wp_query->is_page = true;
            $wp_query->is_singular = true;
            $wp_query->is_404 = false;
        }
        do_action('bp_setup_theme_compat');
    }
}
开发者ID:eresyyl,项目名称:mk,代码行数:78,代码来源:bp-core-catchuri.php

示例8: place_home_dummy_post

 /**
  * Update the global $post with directory data
  *
  * @since BuddyPress (1.7)
  */
 public function place_home_dummy_post()
 {
     bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => __('Search Places', 'bp-checkins'), 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => 'bp_checkins', 'post_status' => 'publish', 'is_archive' => true, 'comment_status' => 'closed'));
 }
开发者ID:socialray,项目名称:surfied-2-0,代码行数:9,代码来源:bp-checkins-screens.php

示例9: single_dummy_post

 /**
  * Update the global $post with the displayed user's data.
  *
  * @since 1.7.0
  */
 public function single_dummy_post()
 {
     bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => __('Activity', 'buddypress'), 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => 'page', 'post_status' => 'publish', 'is_page' => true, 'comment_status' => 'closed'));
 }
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:9,代码来源:class-bp-activity-theme-compat.php

示例10: directory_dummy_post

 /**
  * Update the global $post with directory data
  */
 public function directory_dummy_post()
 {
     bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => apply_filters('task_breaker_projects_dir_title', __('Projects Directory', 'task_breaker')), 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => 'bp_projects', 'post_status' => 'publish', 'is_archive' => true, 'comment_status' => 'closed'));
 }
开发者ID:codehaiku,项目名称:task-breaker,代码行数:7,代码来源:project-screens.php

示例11: create_dummy_post

 /**
  * Update the global $post with dummy data regarding doc creation
  *
  * @since 1.3
  */
 public function create_dummy_post()
 {
     bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => __('Create a Doc', 'bp-docs'), 'post_author' => get_current_user_id(), 'post_date' => 0, 'post_content' => '', 'post_type' => bp_docs_get_post_type_name(), 'post_status' => 'publish', 'is_archive' => true, 'comment_status' => 'closed'));
 }
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:9,代码来源:theme-bridge.php

示例12: create_dummy_post

 /**
  * Update the global $post with create screen data.
  *
  * @since 1.7.0
  */
 public function create_dummy_post()
 {
     // Title based on ability to create blogs.
     if (is_user_logged_in() && bp_blog_signup_enabled()) {
         $title = __('Create a Site', 'buddypress');
     } else {
         $title = __('Sites', 'buddypress');
     }
     bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => $title, 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => 'page', 'post_status' => 'publish', 'is_page' => true, 'comment_status' => 'closed'));
 }
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:15,代码来源:bp-blogs-screens.php

示例13: single_dummy_post

 /**
  * Update the global $post with single group data
  *
  * @since BuddyPress (1.7)
  */
 public function single_dummy_post()
 {
     bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => '<a href="' . bp_get_group_permalink(groups_get_current_group()) . '">' . bp_get_current_group_name() . '</a>', 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => 'bp_group', 'post_status' => 'publish', 'is_page' => true, 'comment_status' => 'closed'));
 }
开发者ID:danielcoats,项目名称:schoolpress,代码行数:9,代码来源:bp-groups-screens.php

示例14: bp_core_load_template

/**
 * Load a specific template file with fallback support.
 *
 * Example:
 *   bp_core_load_template( 'members/index' );
 * Loads:
 *   wp-content/themes/[activated_theme]/members/index.php
 *
 * @param array $templates Array of templates to attempt to load.
 * @return bool|null Returns false on failure.
 */
function bp_core_load_template( $templates ) {
	global $wp_query;

	// Reset the post
	bp_theme_compat_reset_post( array(
		'ID'          => 0,
		'is_404'      => true,
		'post_status' => 'publish',
	) );

	// Set theme compat to false since the reset post function automatically sets
	// theme compat to true
	bp_set_theme_compat_active( false );

	// Fetch each template and add the php suffix
	$filtered_templates = array();
	foreach ( (array) $templates as $template ) {
		$filtered_templates[] = $template . '.php';
	}

	// Only perform template lookup for bp-default themes
	if ( ! bp_use_theme_compat_with_current_theme() ) {
		$template = locate_template( (array) $filtered_templates, false );

	// Theme compat doesn't require a template lookup
	} else {
		$template = '';
	}

	// Filter the template locations so that plugins can alter where they are located
	$located_template = apply_filters( 'bp_located_template', $template, $filtered_templates );
	if ( !empty( $located_template ) ) {
		// Template was located, lets set this as a valid page and not a 404.
		status_header( 200 );
		$wp_query->is_page     = true;
		$wp_query->is_singular = true;
		$wp_query->is_404      = false;

		do_action( 'bp_core_pre_load_template', $located_template );

		load_template( apply_filters( 'bp_load_template', $located_template ) );

		do_action( 'bp_core_post_load_template', $located_template );

		// Kill any other output after this.
		exit();

	// No template found, so setup theme compatibility
	// @todo Some other 404 handling if theme compat doesn't kick in
	} else {

		// We know where we are, so reset important $wp_query bits here early.
		// The rest will be done by bp_theme_compat_reset_post() later.
		if ( is_buddypress() ) {
			status_header( 200 );
			$wp_query->is_page     = true;
			$wp_query->is_singular = true;
			$wp_query->is_404      = false;
		}

		do_action( 'bp_setup_theme_compat' );
	}
}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:74,代码来源:bp-core-catchuri.php

示例15: dummy_post

 /**
  * Update the global $post with dummy data.
  *
  * @since BuddyPress (1.7.0)
  */
 public function dummy_post()
 {
     // Registration page
     if (bp_is_register_page()) {
         $title = __('Create an Account', 'buddypress');
         if ('completed-confirmation' == bp_get_current_signup_step()) {
             $title = __('Check Your Email To Activate Your Account!', 'buddypress');
         }
         // Activation page
     } else {
         $title = __('Activate your Account', 'buddypress');
         if (bp_account_was_activated()) {
             $title = __('Account Activated', 'buddypress');
         }
     }
     bp_theme_compat_reset_post(array('ID' => 0, 'post_title' => $title, 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => 'page', 'post_status' => 'publish', 'is_page' => true, 'comment_status' => 'closed'));
 }
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:22,代码来源:bp-members-screens.php


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