Skip to content

WordPress 3.9: Replace the “paragraph” menu

vergleichThe default menu of WordPress for choosing text styles has bugged me since it exists.

It’s not just that the range of choices is very modest – no, the sucker even forces people without HTML knowledge to code their entries in a bad way. 🙁

Immediately at the second position we can find the fine, italic style “address” – this one hasn’t been invented to make your text italic, but many people use it anyway. That dropdown menu looks like Word and what could possibly be wrong about making my texts italic with <address> instead of <i> or <em>…

The thing is, that the TinyMCE 4 editor WordPress utilizes already has a considerably extensive menu for text styles activated by default – but the developers of WordPress don’t seem to have much confidence in their users being capable of handling this. That’s what I call dumbing down software at its finest.

I wrote a little plugin that replaces the messy menu with the correct one. Done:

<?php
/**
 * @package TinyMCE Fixer
 * @version 1.0
 */
/*
Plugin Name: TinyMCE Fixer
Plugin URI: https://schmatzler.de
Description: Replace the paragraph menu in the editor
Author: Ronny Schmatzler
Version: 1.0
Author URI: https://schmatzler.de/
*/
function addstyle($buttons)
 {
 //Add style selector to the beginning of the toolbar
 array_unshift($buttons, 'styleselect');
 return $buttons;
 }
add_filter('mce_buttons_2','addstyle');
function removeformat($buttons)
 {
 //Remove the default format selector
 $remove = array('formatselect');
 return array_diff($buttons,$remove);
 }
add_filter('mce_buttons_2','removeformat');
?>

This Post Has 0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top