本文整理汇总了PHP中WP_Customize_Manager::start_previewing_theme方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_Customize_Manager::start_previewing_theme方法的具体用法?PHP WP_Customize_Manager::start_previewing_theme怎么用?PHP WP_Customize_Manager::start_previewing_theme使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WP_Customize_Manager
的用法示例。
在下文中一共展示了WP_Customize_Manager::start_previewing_theme方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_customize_link
/**
* @ticket 30937
* @covers wp_admin_bar_customize_menu()
*/
public function test_customize_link()
{
global $wp_customize;
require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
$uuid = wp_generate_uuid4();
$this->go_to(home_url("/?customize_changeset_uuid={$uuid}"));
wp_set_current_user(self::$admin_id);
$this->factory()->post->create(array('post_type' => 'customize_changeset', 'post_status' => 'auto-draft', 'post_name' => $uuid));
$wp_customize = new WP_Customize_Manager(array('changeset_uuid' => $uuid));
$wp_customize->start_previewing_theme();
set_current_screen('front');
$wp_admin_bar = $this->get_standard_admin_bar();
$node = $wp_admin_bar->get_node('customize');
$this->assertNotEmpty($node);
$parsed_url = wp_parse_url($node->href);
$query_params = array();
wp_parse_str($parsed_url['query'], $query_params);
$this->assertEquals($uuid, $query_params['changeset_uuid']);
$this->assertNotContains('changeset_uuid', $query_params['url']);
}
示例2:
/**
* @see WP_Widget::is_preview()
*/
function test_wp_widget_is_preview()
{
global $wp_customize;
$widget = new WP_Widget('foo', 'Foo');
$this->assertEmpty($wp_customize);
$this->assertFalse($widget->is_preview());
wp_set_current_user($this->factory->user->create(array('role' => 'administrator')));
require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
$wp_customize = new WP_Customize_Manager();
$wp_customize->start_previewing_theme();
$this->assertTrue($widget->is_preview());
}
示例3: array
/**
* @group site_icon
* @ticket 38377
*/
function test_customize_preview_wp_site_icon_dirty()
{
global $wp_customize;
wp_set_current_user($this->factory()->user->create(array('role' => 'administrator')));
require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
$wp_customize = new WP_Customize_Manager();
$wp_customize->register_controls();
$wp_customize->start_previewing_theme();
$attachment_id = $this->_insert_attachment();
$wp_customize->set_post_value('site_icon', $attachment_id);
$wp_customize->get_setting('site_icon')->preview();
$output = array(sprintf('<link rel="icon" href="%s" sizes="32x32" />', esc_url(wp_get_attachment_image_url($attachment_id, 32))), sprintf('<link rel="icon" href="%s" sizes="192x192" />', esc_url(wp_get_attachment_image_url($attachment_id, 192))), sprintf('<link rel="apple-touch-icon-precomposed" href="%s" />', esc_url(wp_get_attachment_image_url($attachment_id, 180))), sprintf('<meta name="msapplication-TileImage" content="%s" />', esc_url(wp_get_attachment_image_url($attachment_id, 270))), '');
$output = implode("\n", $output);
$this->expectOutputString($output);
wp_site_icon();
}