Support » Plugins » Hacks » Add simple button to Tiny MCE

  • Hi there, just wondering if anyone has a simple plug in or code snippet that can help me achieve this. Basically all I need to do, is wrap a block of text in a div, but this functionality needs to be integrated into the TinyMCE so that the client can easily do it themselves without writing code.

    So basically what I need to do is

    • Add a button to the tiny mce
    • Program the button to have the following functionality:

    Wraps selected text in the following:
    <div id="goToSidebar">selected text</div>

Viewing 2 replies - 1 through 2 (of 2 total)
  • I’d recommend a shortcode

    add_shortcode( 'goto', 'my_goto_function')
    function my_goto_function( $atts, $content ) {
        $out = '<div id="goToSidebar">' . $content . '</div>';
        return $out;

    Then all your client would have to learn is;

    [goto]Selected Text[/goto]

    Hi Jackson, that’s actually a pretty good solution! We’ve decided to do this via tags however now, so if a post has a specific tag, a specific sidebar element is shown. Thanks for the tip though this might come in handy for something else.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add simple button to Tiny MCE’ is closed to new replies.