本文整理汇总了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);
}
示例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'])) {