Skip to content

Instantly share code, notes, and snippets.

@tacensi
Created March 12, 2018 17:11
Show Gist options
  • Save tacensi/85a4789920896ab70fc199a4c8c773a6 to your computer and use it in GitHub Desktop.
Save tacensi/85a4789920896ab70fc199a4c8c773a6 to your computer and use it in GitHub Desktop.
WP Custom MCE Buttons
// Acrescentando botões de estilo no
add_filter( 'mce_buttons_2', 'my_mce_buttons_2' );
function my_mce_buttons_2( $buttons ) {
array_unshift( $buttons, 'styleselect' );
return $buttons;
}
add_filter( 'tiny_mce_before_init', 'my_mce_before_init' );
function my_mce_before_init( $settings ) {
$style_formats = array(
array(
'title' => 'Button',
'selector' => 'a',
'classes' => 'button'
),
array(
'title' => 'Texto em destaque',
'block' => 'div',
'classes' => 'intro',
'wrapper' => true
),
array(
'title' => 'Lista com bullets',
'block' => 'ul',
'classes' => 'semi-list diferenciais',
'wrapper' => true
),
array(
'title' => 'Box de informação',
'block' => 'div',
'classes' => 'box coordenacao container',
'wrapper' => true
),
);
$settings['style_formats'] = json_encode( $style_formats );
return $settings;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment