Skip to content

Instantly share code, notes, and snippets.

@neverything
Created March 29, 2014 22:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neverything/9863732 to your computer and use it in GitHub Desktop.
Save neverything/9863732 to your computer and use it in GitHub Desktop.
Overwrite or extend tiny mce styles dropdown in required-starter child theme.
<?php
/**
* Change options in the TinyMCE Styles dropdown
* @param array $args default styles array as seen in req-mce.php
* @return array our custom styles for the dropdown
*/
function req_starter_editor_stlye_args_filter( $args ) {
$custom_args = array(
array(
'title' => __( 'Notes', 'required-starter' ),
'block' => 'div',
'classes' => 'note-paper', // Add your classes here
'wrapper' => true
),
array(
'title' => __( 'Lead-Text', 'required-starter' ),
'block' => 'div',
'classes' => 'lead', // Add your classes here
'wrapper' => true
),
array(
'title' => __( 'Image', 'required-starter' ),
'block' => 'figure',
'classes' => 'content-img', // Add your classes here
'wrapper' => true
),
array(
'title' => __( 'Partner Logos', 'required-starter' ),
'block' => 'div',
'classes' => 'partner-logos', // Add your classes here
'wrapper' => true
),
array(
'title' => __( 'Button', 'required-starter' ),
'selector' => 'a',
'classes' => 'button', // Add your classes here
'exact' => true
),
);
// Since you only have custom styles,
// we throw away the default $args array
// and simply return your styles.
return $custom_args;
// The alternative would be to use array_merge to
// combine the original $args and our $custom_args
//return array_merge($args, $custom_args);
}
add_filter( 'req_editor_stlye_args', 'req_starter_editor_stlye_args_filter' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment