Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Does anyone know the steps needed to add a custom format to the blockformat (p,h1,h2,h3 etc.) dropdown in the tinyMCE editor in Wordpress?

I've found a lot of different ways to do that, which seem to either contradict each other or have absolutely no effect.

I've had very little interaction with Wordpress as a developer so I'm not even sure where what is located. wordpress tinymce

share|improve this question

1 Answer 1

up vote 0 down vote accepted
function extend_tiny_mce_defaults( $config )
{
    // comma separated list of any block-level HTML tag
    $config['theme_advanced_blockformats'] = 'h1,h2,h3,h4,h5,h6,p,code,address';
    return $init;
}
add_filter( 'tiny_mce_before_init', 'extend_tiny_mce_defaults', 100 );
share|improve this answer
    
Where does that go, and does that method allow me to add a custom block format of my design? –  VikingGoat Jan 8 '12 at 20:13
    
Drop it in a plugin or your theme's functions.php. As for your 'custom' block format, if it's not just a standard HTML element (i.e. you want it to do a little more) you might be better off implementing a custom Tiny MCE button instead. –  TheDeadMedic Jan 8 '12 at 23:48
    
I ended up installing Advanced TinyMCE Configuration and Advanced TinyMCE Configuration, was working great until I updated 3.3 and now style doesn't get rendered in the editor, but other wise works fine. –  VikingGoat Jan 9 '12 at 3:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.