當前位置: 首頁>>代碼示例>>PHP>>正文


PHP WP_Theme::network_enable_theme方法代碼示例

本文整理匯總了PHP中WP_Theme::network_enable_theme方法的典型用法代碼示例。如果您正苦於以下問題:PHP WP_Theme::network_enable_theme方法的具體用法?PHP WP_Theme::network_enable_theme怎麽用?PHP WP_Theme::network_enable_theme使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WP_Theme的用法示例。


在下文中一共展示了WP_Theme::network_enable_theme方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: test_wp_theme_network_enable_multiple_themes

 /**
  * Enable multiple themes on a network.
  *
  * @ticket 30594
  */
 function test_wp_theme_network_enable_multiple_themes()
 {
     if (!is_multisite()) {
         $this->markTestSkipped('This test requires multisite');
     }
     $themes = array('testtheme-2', 'testtheme-3');
     $current_allowed_themes = get_site_option('allowedthemes');
     WP_Theme::network_enable_theme($themes);
     $new_allowed_themes = get_site_option('allowedthemes');
     update_site_option('allowedthemes', $current_allowed_themes);
     // reset previous value.
     $current_allowed_themes = array_merge($current_allowed_themes, array('testtheme-2' => true, 'testtheme-3' => true));
     $this->assertEqualSetsWithIndex($current_allowed_themes, $new_allowed_themes);
 }
開發者ID:atimmer,項目名稱:wordpress-develop-mirror,代碼行數:19,代碼來源:WPTheme.php

示例2: wp_safe_redirect

         wp_safe_redirect(add_query_arg('enabled', 1, $referer));
     }
     exit;
 case 'disable':
     check_admin_referer('disable-theme_' . $_GET['theme']);
     WP_Theme::network_disable_theme($_GET['theme']);
     wp_safe_redirect(add_query_arg('disabled', '1', $referer));
     exit;
 case 'enable-selected':
     check_admin_referer('bulk-themes');
     $themes = isset($_POST['checked']) ? (array) $_POST['checked'] : array();
     if (empty($themes)) {
         wp_safe_redirect(add_query_arg('error', 'none', $referer));
         exit;
     }
     WP_Theme::network_enable_theme((array) $themes);
     wp_safe_redirect(add_query_arg('enabled', count($themes), $referer));
     exit;
 case 'disable-selected':
     check_admin_referer('bulk-themes');
     $themes = isset($_POST['checked']) ? (array) $_POST['checked'] : array();
     if (empty($themes)) {
         wp_safe_redirect(add_query_arg('error', 'none', $referer));
         exit;
     }
     WP_Theme::network_disable_theme((array) $themes);
     wp_safe_redirect(add_query_arg('disabled', count($themes), $referer));
     exit;
 case 'update-selected':
     check_admin_referer('bulk-themes');
     if (isset($_GET['themes'])) {
開發者ID:CompositeUK,項目名稱:clone.WordPress-Core,代碼行數:31,代碼來源:themes.php


注:本文中的WP_Theme::network_enable_theme方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。