2017-01-17 23:04:04 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Understrap modify editor
|
|
|
|
*
|
|
|
|
* @package understrap
|
|
|
|
*/
|
|
|
|
|
2017-01-18 07:45:50 +00:00
|
|
|
/**
|
|
|
|
* Registers an editor stylesheet for the theme.
|
|
|
|
*/
|
2017-11-29 09:26:50 +00:00
|
|
|
function wpdocs_theme_add_editor_styles() {
|
2017-01-27 13:26:46 +00:00
|
|
|
add_editor_style( 'css/custom-editor-style.css' );
|
2017-01-18 07:45:50 +00:00
|
|
|
}
|
2017-11-29 09:26:50 +00:00
|
|
|
add_action( 'admin_init', 'wpdocs_theme_add_editor_styles' );
|
2017-01-18 07:45:50 +00:00
|
|
|
|
2017-01-27 13:26:46 +00:00
|
|
|
// Add TinyMCE style formats.
|
2017-01-17 23:04:04 +00:00
|
|
|
add_filter( 'mce_buttons_2', 'understrap_tiny_mce_style_formats' );
|
|
|
|
|
|
|
|
function understrap_tiny_mce_style_formats( $styles ) {
|
|
|
|
|
|
|
|
array_unshift( $styles, 'styleselect' );
|
|
|
|
return $styles;
|
|
|
|
}
|
|
|
|
|
|
|
|
add_filter( 'tiny_mce_before_init', 'understrap_tiny_mce_before_init' );
|
|
|
|
|
|
|
|
function understrap_tiny_mce_before_init( $settings ) {
|
|
|
|
|
|
|
|
$style_formats = array(
|
|
|
|
array(
|
|
|
|
'title' => 'Lead Paragraph',
|
|
|
|
'selector' => 'p',
|
|
|
|
'classes' => 'lead',
|
|
|
|
'wrapper' => true
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'title' => 'Small',
|
|
|
|
'inline' => 'small'
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'title' => 'Blockquote',
|
|
|
|
'block' => 'blockquote',
|
|
|
|
'classes' => 'blockquote',
|
|
|
|
'wrapper' => true
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'title' => 'Blockquote Footer',
|
|
|
|
'block' => 'footer',
|
|
|
|
'classes' => 'blockquote-footer',
|
|
|
|
'wrapper' => true
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'title' => 'Cite',
|
|
|
|
'inline' => 'cite'
|
|
|
|
)
|
|
|
|
);
|
2017-02-02 13:05:52 +00:00
|
|
|
|
|
|
|
if ( isset( $settings['style_formats'] ) ) {
|
|
|
|
$orig_style_formats = json_decode($settings['style_formats'],true);
|
|
|
|
$style_formats = array_merge($orig_style_formats,$style_formats);
|
|
|
|
}
|
|
|
|
|
2017-01-17 23:04:04 +00:00
|
|
|
$settings['style_formats'] = json_encode( $style_formats );
|
|
|
|
return $settings;
|
|
|
|
}
|