Skip to content

Instantly share code, notes, and snippets.

@simplethemes
Created October 20, 2015 21:51
Show Gist options
  • Save simplethemes/3ef74e3838a9d319b3ed to your computer and use it in GitHub Desktop.
Save simplethemes/3ef74e3838a9d319b3ed to your computer and use it in GitHub Desktop.
Add toolbars to ACF
<?php
if (! function_exists('st_acf_toolbars')) {
function st_acf_toolbars() {
// Full
$toolbars['Full'] = array();
$toolbars['Full'][1] = apply_filters('mce_buttons', array('code','bold', 'italic', 'strikethrough', 'bullist', 'numlist', 'blockquote', 'justifyleft', 'justifycenter', 'justifyright', 'link', 'unlink', 'wp_more', 'spellchecker', 'fullscreen', 'wp_adv' ), $editor_id);
$toolbars['Full'][2] = apply_filters('mce_buttons_2', array( 'formatselect', 'underline', 'justifyfull', 'forecolor', 'pastetext', 'pasteword', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo'), $editor_id);
$toolbars['Full'][3] = apply_filters('mce_buttons_3', array(), $editor_id);
$toolbars['Full'][4] = apply_filters('mce_buttons_4', array(), $editor_id);
// Basic
$toolbars['Basic'] = array();
$toolbars['Basic'][1] = apply_filters( 'teeny_mce_buttons', array('bold', 'italic', 'underline', 'blockquote', 'strikethrough', 'bullist', 'numlist', 'justifyleft', 'justifycenter', 'justifyright', 'undo', 'redo', 'link', 'unlink', 'fullscreen'), $editor_id );
// Simple
$toolbars['Simple'] = array();
$toolbars['Simple'][1] = apply_filters('teeny_mce_buttons', array( 'code', 'formatselect', 'bold', 'italic', 'bullist', 'numlist', 'justifyleft', 'justifycenter', 'justifyright', 'link', 'unlink', 'removeformat' ), $editor_id);
return $toolbars;
}
}
add_filter( 'acf/fields/wysiwyg/toolbars', 'st_acf_toolbars', 1, 1 );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment