Formating controls for headings (h1, h2, h3...) are not included in the base TinyMCE package. However there is a 3rd Party TinyMCE plugin that provides this.

  1. Download the plugin from SourceForge.
  2. Unzip the files and place header directory in your modules/tinymce/tinymce/jscripts/tiny_mce/plugins folder.
  3. The TinyMCE Drupal module handles plugins differently than stock TinyMCE, hence the standard plugin installation instructions do not apply. Instead edit the modules/tinymce/plugin_reg.php file and add the following lines immediately before return $plugins;
    
    $plugins['heading'] = array();
    $plugins['heading']['theme_advanced_buttons1'] = array('h1,h2,h3,h4,h5,h6,separator');
    $plugins['heading']['heading_clear_tag'] = array('p');
    
    
  4. on the TinyMCE settings page you should now see a button entry for the headings: "h1,h2,h3,h4,h5,h6,separator – heading". Enable the button.

That's it, you should now see buttons for headings in your editor.

Drupal 6

As of Jan 2009, All you need to do is enable "HTML block format" if using the latest dev for 6.x

Comments

jsims281’s picture

Using HTML Block Format is definitely the best way to do this.

If anyone still uses the plugin for older versions, I found putting this code in a custom module worked well, once the plugin was downloaded:

/**
* Implementation of hook_wywiwyg_plugin().
*/
function FOOBAR_wysiwyg_plugin($editor, $version=0) {
  $plugins = array();
  switch ($editor) {
    case 'tinymce':
      if ($version > 3) {                       
          $plugins['heading'] = array(
          'type' => 'external',
          'title' => t('Headings'),
          'description' => t('Provides H1-H6 buttons for tinyMCE'),
          'path' => wysiwyg_get_path($editor) . '/jscripts/tiny_mce/plugins/heading/editor_plugin.js',
          'buttons' => array(
            'h1' => t('H1'),
            'h2' => t('H2'),
            'h3' => t('H3'),
            'h4' => t('H4'),
            'h5' => t('H5'),
            'h6' => t('H6'),
           ),
           'url' => 'http://sourceforge.net/tracker/index.php?func=detail&aid=1467705&group_id=103281&atid=738747',
           'load' => TRUE,
        );                      
      }
      break;
  }
  return $plugins;
}

(found this here http://openconcept.ca/blog/stevem/howto_add_headings_tinymce_plugin_to_w...)

vood002’s picture

I followed these instructions by jsims281 which have worked for me with Drupal 6, but no dice in drupal 7.

Does anyone know if there is an additional step necessary?

The options show up on the WYSIWYG configuration page, but they don't show up on the content authoring pages even after being checked and saved.

mikemadison’s picture

I can get the buttons to appear in Drupal 7, but when clicking on them I just get an error in the console that makes me think it's a no go.

Nora McDougall’s picture

Seems like a pretty important thing to have for Drupal 7 and beyond! I have a client who wants it too.

mksweet’s picture

Use the " HTML block format" button that comes with TinyMCE. It adds Headers (H1 H2 H3 etc).

druvision’s picture

That works in my Drupal 7 installation. The plugin is called "Block Format"