Include tab ext in theme

Support MB Tabs Include tab ext in theme

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #2607
    easywpeasywp
    Participant

    Hi, As you know I am using meta-box plugin in theme using

    //add meta box
    $metaboxplugin = get_template_directory() . '/inc/meta-box/meta-box.php';
    $metabox = get_template_directory() . '/inc/meta-box.php';
    //$metaboxtabs = get_template_directory() . '/inc/meta-box-tabs/meta-box-tabs.php';
    
    if(file_exists($metabox)) {
    	require_once $metaboxplugin;
        require_once $metabox;
    	//require_once $metaboxtabs;
    }

    But including tabs from theme folder does not work properly. What I am missing plz?

    Also its very needed to include meta box in theme bcoz I can't provide support to all of these custom themes I created using meta-box plugin. Updating to new version on around 20 themes taking a good amount of time for me. Thanks !

    #2612
    Anh TranAnh Tran
    Keymaster

    I highly recommend to include the main plugin and extensions using the TGM Activation Class. The TGM Activation Class is being proposed to be included in WordPress core. So, we have good reasons to use it.

    But, if you want to include the tab extension in your theme anyway, then you have to do 2 things:
    - Include the plugin main file
    - Enqueue correct CSS/JS files

    Your code above only did the 1st thing. To enqueue CSS/JS file, you can do this:

    add_action( 'rwmb_enqueue_scripts', 'prefix_meta_box_tabs_enqueue' );
    function prefix_meta_box_tabs_enqueue()
    {
        wp_enqueue_style( 'tabs-ext', get_template_directory_uri() . '/inc/meta-box-tabs/tabs.css' );
        wp_enqueue_script( 'tabs-ext', get_template_directory_uri() . '/inc/meta-box-tabs/tabs.js', array( 'jquery' ), '', true );
    }

    Please double check the URL to files tabs.css and tabs.js.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The topic ‘Include tab ext in theme’ is closed to new replies.