首页 文章

如何将“编辑快捷方式”图标添加到Wordpress自定义程序

提问于
浏览
7

如何将WordPress 4.7中的“编辑快捷方式”图标新功能添加到自定义程序 . 我想在我的主题定制器中的任何位置添加此图标

Wordpress Edit Shortcut icon

1 回答

  • 1

    这些在Customizer Preview中称为“可见编辑快捷方式” . 你应该在这里阅读更多相关信息:

    https://make.wordpress.org/core/2016/11/10/visible-edit-shortcuts-in-the-customizer-preview/

    它是选择性刷新的扩展:

    $wp_customize->get_setting( 'blogname' )->transport        = 'postMessage';
    $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
    
    $wp_customize->selective_refresh->add_partial( 'blogname', array(
        'selector' => '.site-title a',
        'render_callback' => 'twentyfifteen_customize_partial_blogname',
    ) );
    $wp_customize->selective_refresh->add_partial( 'blogdescription', array(
        'selector' => '.site-description',
        'render_callback' => 'twentyfifteen_customize_partial_blogdescription',
    ) );
    

    渲染回调调用 bloginfo( 'name' );bloginfo( 'description' ); 的位置

    https://make.wordpress.org/core/2016/02/16/selective-refresh-in-the-customizer/

    还看看官方Customizer documentation

    所以基本上如果您在自定义程序中进行了选择性刷新,默认情况下会出现这些;)

相关问题