Posts Add Background Color (Highlight) Option in WordPress Editor TinyMCE
Post
Cancel

Add Background Color (Highlight) Option in WordPress Editor TinyMCE

add this to functions.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//src - https://gist.github.com/thierrypigot/7fe4b3e40735d4b9a3ca
<?php
/* Hook to init */
add_action( 'init', 'tp_editor_background_color' );

/**
 * Add TinyMCE Button
 */
function tp_editor_background_color()
{
	/* Add the button/option in second row */
	add_filter( 'mce_buttons_2', 'tp_editor_background_color_button', 1, 2 ); // 2nd row
}

/**
 * Modify 2nd Row in TinyMCE and Add Background Color After Text Color Option
 */
function tp_editor_background_color_button( $buttons, $id )
{
	/* Only add this for content editor, you can remove this line to activate in all editor instance */
	if ( 'content' != $id )
		return $buttons;
	/* Add the button/option after 4th item */
	array_splice( $buttons, 4, 0, 'backcolor' );
	return $buttons;
}

origin - http://www.pipiscrew.com/?p=13747 add-background-color-highlight-option-in-wordpress-editor-tinymce

This post is licensed under CC BY 4.0 by the author.
Contents

Trending Tags