Skip Navigation

Styles missing when using The Plus Addons for Gutenberg plugin

Won't fix

Symptoms

If you add blocks from “The Plus Addons for Gutenberg” plugin to Toolset templates, any custom styles you apply to such blocks will be missing from posts displayed using that template.

Workaround

You can add the following PHP (e.g. to Toolset > Settings > Custom Code) which will enqueue styles from blocks added to templates whenever those templates are used to display content:

/**
 * Enqueue the_plus_addons styles and scripts for blocks added to Toolset templates
 */
if ( defined('TPGB_VERSION') && defined('TPGB_ASSET_URL') ){

    add_filter( 'wpv_filter_content_template_output', 'ts_plus_addons_compat', 10, 2 );

    function ts_plus_addons_compat( $content, $template_id ){

        if ( file_exists(TPGB_ASSET_PATH . '/plus-css-' . $template_id . '.css') ){
            $css_file = TPGB_ASSET_URL . '/plus-css-' . $template_id . '.css';
            wp_enqueue_style("tpgb-template-$template_id-css", $css_file, false, "" );
        }

        return $content;
    }
}

Leave
a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>