An Helper Class to create TinyMCE button and Shortcode editor
##Installation
- Download the pack from here and place it in your plugin or theme.
- Include
Easy-tinyMCE.class.php
andEasy-tinyMCE-content.class.php
in your theme's functions.php file or plugin file - Now call the class just like the code below.
$shortwell_TinyMCE = new Easy_TinyMCE_Class; $shortwell_TinyMCE->title = 'Shortcode Tittle'; $shortwell_TinyMCE->js_url = get_template_directory_uri().'/tinymce/tinyMCE-plugin.js'; $shortwell_TinyMCE->uid = 'shortcode_unique_id'; $shortwell_TinyMCE->templates = array( array('name'=> 'Soundcloud', 'url'=> get_template_directory().'/tinymce/audio-TinyMCE.php'), array('name'=> 'Alert', 'url'=> get_template_directory().'tinymce/alert-TinyMCE.php'), array('name'=> 'Accordion', 'url'=> get_template_directory().'tinymce/accordion-TinyMCE.php'), );
- Now find the
tinyMCE-plugin-sample.js
and rename it totinyMCE-plugin.js
and open it - Replace the
_____id_____
with theshortcode_unique_id
,_____title_____
with shortcode title and____icon_____
with icon path - create and new file call
audio-TinyMCE.php
and put the code like below
id = 'accordion'; $tinyMCE->shortcode = 'accordion'; $tinyMCE->content = true; $tinyMCE->options = array( array( 'id' => 'class', 'field' => 'text', //text, textarea, select post-select, tax-select 'title' => __( 'Div Class', 'shortwell_textdomain' ), 'des' => '', 'post_type' => '', 'multiple' => false, 'content' => false, 'option' => '', ), array( 'id' => 'link', 'field' => 'textarea', //text, textarea, select post-select, tax-select 'title' => __( 'Link', 'shortwell_textdomain' ), 'des' => '', 'post_type' => '', 'std' => '[accordion_item title="Accordion 1"] .... Content onw11 ....[/] [accordion_item title="Accordion 1"] .... Content onw11 ....[/accordion_item] [accordion_item title="Accordion 1"] .... Content onw11 ....[/accordion_item]', 'multiple' => false, 'content' => true, 'option' => '', ) ); $tinyMCE->html();
That's all
I have included an example folder with the working example. Don't forget to check it