title: Custom button on WP Tiny MCE Posts Editor for Shortcodes
body: <p>Trying to create a special button on the Tiny MCE editor on the Post Editor of Wordpress. I want to create a button for my created shortcode tooltips.</p>
  
  <p>Check out my desired output: </p>
  
  <p><img src="https://i.imgur.com/DHdUhR8.jpg" alt=""></p>
  
  <p>I have the following code for my Tooltip shortcode:</p>
  
  <pre><code>//Text tooltip
  function tooltip($atts, $content = ''){
      $atts = shortcode_atts(
          array(
            'class' =&gt; '',
            'title' =&gt; ''
          ), $atts);
  
  
       $html = '&lt;a class="' . $atts['class'] .'"  title="'. $atts['title']. '" href="#"&gt;' . $content . ' &lt;span&gt;' .$atts['title']. '&lt;/span&gt; &lt;/a&gt;';
      return $html;    
    } 
  
  add_shortcode('tooltip', 'tooltip');
  </code></pre>
  
  <p>Now when you execute this you will use the following codes for the shortcode:</p>
  
  <pre><code>[tooltips class="top_tooltip" title="Your Tooltip here"] Text here [/tooltip]
  </code></pre>
  
  <p>What I have done is that created some function to DISPLAY MY CREATED CUSTOM BUTTON TOOLTIP SHORTCODE on the functions.php file on my theme using the following codes.</p>
  
  <pre><code>//Create Tiny MCE buttons
  function mce_tooltip($button) {
    $buttons[] = 'superscript';
    return $button;
  }
  add_filter('mce_buttons_2', 'mce_tooltip');
  
  
  
  /*
  * Callback function to filter the MCE settings
  */
  
  function mce_tooltip( $init_array ) {  
  
  // Define the style_formats array
  
    $style_formats = array(  
      // Each array child is a format with it's own settings
      array(  
        'class' =&gt; '',  
        'title' =&gt; ''      
    );  
    // Insert the array, JSON ENCODED, into 'style_formats'
    $init_array['style_formats'] = json_encode( $style_formats );  
  
    return $init_array;  
  
  } 
  // Attach callback to 'tiny_mce_before_init' 
  add_filter( 'tiny_mce_before_init', 'mce_tooltip' ); 
  </code></pre>
  
  <p>I tried the code but it won't show up my CUSTOM button for my shortcode on the TINY MCE Editor on Wordpress. Any idea how to do it better?</p>