A Code field can be inserted in:
- an Admin Page, as an option or a user_meta
- a User Profile, as a user_meta
- a Metabox, as a post_meta
The code below is used to generate this section in an Admin Page, for an option:
Copy to Clipboard
A Code inherit from a Field, and an Item, then all settings described in Field Settings and Item Settings are also used.
Specific settings for Code:
Code Settings | Description |
---|---|
lang string / Default: ‘css’ |
The language used for syntax highlighting for this option. Supported languages: css, html, javascript, json, less, lua, markdown, mysql, php, plain_text, python, ruby, sass, scss, sh, text, xml But only css and scss are compiled and used in website |
theme string / Default: ‘chrome’ |
The color theme used in the option. Supported themes: ambiance, chaos, chrome, clouds_midnight, clouds, cobalt, crimson_editor, dawn, dreamweaver, eclipse, github, idle_fingers, iplastic, katzenmilch, kr_theme, kuroir, merbivore_soft, merbivore, mono_industrial, monokai, pastel_on_dark, solarized_dark, solarized_light, sqlserver, terminal, textmate, tomorrow_night_blue, tomorrow_night_bright, tomorrow_night_eighties, tomorrow_night, tomorrow, twilight, vibrant_ink, xcode |
height int / Default: 200 |
The height of the editor in pixels. |
enqueue boolean / Default: true |
The inputted code is automatically included in the frontend if the lang parameter is css or javascript .Setting this to false forces the option to stop including the code in the front end. This is useful if you want to use the option value in the back end or somewhere else. |