首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Wordpress编辑器-style.css不工作

Wordpress编辑器-style.css不工作
EN

Stack Overflow用户
提问于 2013-11-19 23:37:06
回答 1查看 2.6K关注 0票数 0

我想添加一个editor-style.css文件,这样我就可以更改编辑器样式以匹配我的模板。

我在functions.php文件的顶部添加了以下内容:

代码语言:javascript
复制
    function my_theme_add_editor_styles() {
    add_editor_style( 'editor-style.css' );
    }
    add_action( 'init', 'my_theme_add_editor_styles' );

但是这不起作用,我把它放在正确的位置了吗?

代码语言:javascript
复制
/* ========================================================================================================================

Required external files

======================================================================================================================== */

require_once( 'external/starkers-utilities.php' );

/* ========================================================================================================================

Theme specific settings

Uncomment register_nav_menus to enable a single menu with the title of "Primary Navigation" in your theme

======================================================================================================================== */

add_theme_support('post-thumbnails');

// register_nav_menus(array('primary' => 'Primary Navigation'));

/* ========================================================================================================================

Actions and Filters

======================================================================================================================== */

add_action( 'wp_enqueue_scripts', 'starkers_script_enqueuer' );

add_filter( 'body_class', array( 'Starkers_Utilities', 'add_slug_to_body_class' ) );

/* ========================================================================================================================

Custom Post Types - include custom post types and taxonimies here e.g.

e.g. require_once( 'custom-post-types/your-custom-post-type.php' );

======================================================================================================================== */


add_editor_style( $stylesheet ); /* ========================================================================================================================

Scripts

======================================================================================================================== */

/**
 * Add scripts via wp_head()
 *
 * @return void
 * @author Keir Whitaker
 */

function starkers_script_enqueuer() {
    wp_register_script( 'site', get_template_directory_uri().'/js/site.js', array( 'jquery' ) );
    wp_enqueue_script( 'site' );

    wp_register_style( 'screen', get_stylesheet_directory_uri().'/style.css', '', '', 'screen' );
    wp_enqueue_style( 'screen' );
}   

/* ========================================================================================================================

Comments

======================================================================================================================== */

/**
 * Custom callback for outputting comments 
 *
 * @return void
 * @author Keir Whitaker
 */
function starkers_comment( $comment, $args, $depth ) {
    $GLOBALS['comment'] = $comment; 
    ?>
    <?php if ( $comment->comment_approved == '1' ): ?>  
    <li>
        <article id="comment-<?php comment_ID() ?>">
            <?php echo get_avatar( $comment ); ?>
            <h4><?php comment_author_link() ?></h4>
            <time><a href="#comment-<?php comment_ID() ?>" pubdate><?php comment_date() ?> at <?php comment_time() ?></a></time>
            <?php comment_text() ?>
        </article>
    <?php endif;
}
EN

回答 1

Stack Overflow用户

发布于 2019-10-24 23:27:27

试试这个:

代码语言:javascript
复制
    /*
     * This theme styles the visual editor to resemble the theme style,
     * specifically font, colors, icons, and column width.
     */
    add_editor_style( array( 'css/editor-style.css', twentysixteen_fonts_url() ) );

    // Load regular editor styles into the new block-based editor.
    add_theme_support( 'editor-styles' );

    // Load default block styles.
    add_theme_support( 'wp-block-styles' );
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20075707

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档