Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am trying to incorporate zilla shortcode plugin into theme.I have done it nicely but result is not satisfactory.Here is my code

<?php
class ZillaShortcodes {

function __construct() 
{   
    define('ZILLA_TINYMCE_URI', get_template_directory_uri() . '/a/tinymce/');      
    add_action('init', array(&$this, 'init'));
    add_action('admin_init', array(&$this, 'admin_init'));
}

function init()
{
    if( ! is_admin() )
    {
        wp_enqueue_style( 'zilla-shortcodes', get_template_directory_uri() . '/a/shortcodes.css' );
        wp_enqueue_script( 'jquery-ui-accordion' );
        wp_enqueue_script( 'jquery-ui-tabs' );
        wp_enqueue_script( 'zilla-shortcodes-lib', get_template_directory_uri() . '/a/js/custom-script.js', array('jquery', 'jquery-ui-accordion', 'jquery-ui-tabs') );
    }

    if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') )
        return;

    if ( get_user_option('rich_editing') == 'true' )
    {
        add_filter( 'mce_external_plugins', array(&$this, 'add_rich_plugins') );
        add_filter( 'mce_buttons', array(&$this, 'register_rich_buttons') );
    }
}

// --------------------------------------------------------------------------

function add_rich_plugins( $plugin_array )
{
    $plugin_array['zillaShortcodes'] = get_template_directory_uri() . '/a/tinymce/plugin.js';
    return $plugin_array;
}

// --------------------------------------------------------------------------

function register_rich_buttons( $buttons )
{
    array_push( $buttons, "|", 'zilla_button' );
    return $buttons;
}

/**
 * Enqueue Scripts and Styles
 *
 * @return  void
 */
function admin_init()
{
    // css
    wp_enqueue_style( 'zilla-popup', get_template_directory_uri() . '/a/tinymce/css/popup.css', false, '1.0', 'all' );

    // js
    wp_enqueue_script( 'jquery-ui-sortable' );
    wp_enqueue_script( 'jquery-livequery', ZILLA_TINYMCE_URI . '/js/jquery.livequery.js', false, '1.1.1', false );
    wp_enqueue_script( 'jquery-appendo', ZILLA_TINYMCE_URI . '/js/jquery.appendo.js', false, '1.0', false );
    wp_enqueue_script( 'base64', ZILLA_TINYMCE_URI . '/js/base64.js', false, '1.0', false );
    wp_enqueue_script( 'zilla-popup', ZILLA_TINYMCE_URI . '/js/popup.js', false, '1.0', false );

    wp_localize_script( 'jquery', 'ZillaShortcodes', array('plugin_folder' => WP_PLUGIN_URL .'/zilla-shortcodes') );
}

}
$zilla_shortcodes = new ZillaShortcodes();
share|improve this question
    
What do you mean by 'result is not satisfactory' and why are you trying to incorporate zilla shortcode plugin into theme? –  Vinod Dalvi Sep 8 '13 at 7:23
    
Ah..I am trying to make a theme and want to incorporate zilla shortcode .I do not want to use as plugin.And result is not satisfactory as tabs and toggle is not working . –  ashraf Sep 8 '13 at 7:47
    
Have you enqueued zilla-shortcodes-lib.js file or it's content (by copying it in another js file) in front end ? –  Vinod Dalvi Sep 8 '13 at 7:50
    
No theme should contain a shortcode. Ever. This would lower the quality of you theme drastically. –  toscho Sep 8 '13 at 8:14
    
What about premium themes at Theme forest?They contain shortcodes.I mean I want to add button shortcode,you tube etc @toscho –  ashraf Sep 8 '13 at 9:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.