跳到内容

ACF WYSIWYG Styling

v2.0.1

delwinv · 2015年8月27日 上架

Provides the necessary CSS classes in ACF WYSYWIG editor to allow for complete styling of the admin interface.

正在使用
80+
评分
暂无
累计下载
3,810
最近更新
2026年11月12日
需要 WordPress 7.0+已测试到 7.1.5

贡献者

A very tiny plugin that adds the ACF field key, field name, Flexible Content field name and Flexible Content layout name to the WYSIWYG
editor body tag, allowing you to target these classes, along with the existing post-type-* classes added by default by WordPress, in
your editor-style.css for a better admin/editor experience.

This works for both ACF and ACF Pro, version 6+.

Usage

  1. Install the plugin through the Install Plugins interface or by uploading the acf-plugin-wysiwyg-styling folder to your /wp-content/plugins/ directory.
  2. Activate the ACF WYSIWYG Styling plugin from the Admin > Plugins menu.
  3. Create or edit your editor-style.css in your theme directory and use the newly added classes to style your WYSIWYG editors.

For example:

  • The ACF WYSIWYG field with key field_9999ffff11112222 can be targeted with the following CSS:

      body.acf-field-key-field_9999ffff11112222 {
        background-color: red;
      }
    
  • The ACF WYSIWYG field with key field_9999ffff11112222 in the “room” post type can be targeted with the following CSS:

      body.post-type-room.acf-field-key-field_9999ffff11112222 {
        background-color: blue;
      }
    
  • All ACF WYSIWYG fields named “my_wysiwyg” can be targetted with the following CSS:

      body.acf-field-name-my_wysiwyg {
        background-color: yellow;
      }
    
  • All ACF WYSIWYG fields in the Flexible Content field named “page_content” can be targetted with the following CSS:

      body.acf-flex-name-page_content {
        color: green;
      }
    
  • All ACF WYSIWYG fields in the Flexible Content layout field named “test_layout” can be targetted with the following CSS:

      body.acf-layout-test_layout {
        font-family: "Computer Modern Serif";
      }
    
  • The ACF WYSIWYG field named “my_wysiwyg” in the Flexible Content layout field named “test_layout” can be targetted with the following CSS:

      body.acf-layout-test_layout.acf-field-name-my_wysiwyg {
        border: 4px solid red;
        height: 100%;
        margin: 0 auto;
        max-width: 100px;
      }
    

N.B. I target using the body tag so that a user cannot accidentally target the admin CSS in their edit of the field (regardless of how unlikely
that would be).

Plums

按场景查找 WordPress 插件。安装量、评分和兼容版本来自官方目录。

导航

说明

WordPress 是 WordPress Foundation 的商标。本站与 WordPress Foundation、Automattic 没有隶属关系。这里不托管插件文件,下载和安装以 WordPress.org 上的页面为准。

© 2026 Plums