Home Forums Weaver Xtreme Theme How to disable theme options

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #17702
    Tigermama
    Participant

    Hi… For several reasons, I would prefer not to load the theme options (/ custom) css and instead just use my child theme’s style.css. Can this be done, and how?

    Disclaimer: I know that this is one of the main features of Weaver – but I appreciate its internal structure so much more than all the css options.
    Thanks, Tigermama
    #21777
    Weaver
    Keymaster

    Add this code to your child’s functions.php. You can modify as you see fit. It is commented. It will effectivdely replace the equivalent code in the main theme’s functions.php by redefining the included actions.

    add_action(‘wp_head’, ‘weaverx_no_generated_stylesheet’,7);
    function weaverx_no_generated_stylesheet() {
    // this will not include the generated stylesheet from Weaver X-Plus.
    wp_dequeue_style(‘weaverxp-style-sheet’);
    }

    add_action(‘get_header’, ‘my_fix_actions’);        // need to do this BEFORE wp_head actions, thus get_header
    function my_fix_actions() {
        remove_action(‘wp_head’, ‘weaverx_wp_head_early’,7);
        add_action(‘wp_head’, ‘weaverx_new_wp_head_early’,6);
    }

    function weaverx_new_wp_head_early() {
        // Add stylesheets
        // need the following for genericons
        $sheet = get_template_directory_uri() . ‘/assets/css/fonts’.WEAVERX_MINIFY.’.css’;
        wp_enqueue_style(‘weaverx-font-sheet’,$sheet,array(),WEAVERX_VERSION,’all’);

        // Start with the “real” stylesheet (so child theme style.css can override)
        // comment out the next to to not use theme’s stylesheet
       
        $sheet = get_template_directory_uri() . ‘/assets/css/style-weaverx’.WEAVERX_MINIFY.’.css’;
       
        // comment out the following to remove the standard style-weaverx.css style sheet.

        // wp_enqueue_style(‘weaverx-style-sheet’,$sheet,array(‘weaverx-font-sheet’),WEAVERX_VERSION,’all’);
       

        if ( is_child_theme() ) {  // don’t bother with empty main style.css

            $sheet_dev = get_stylesheet_directory_uri() . ‘/style.css’;    // get style.css
            $sheet = str_replace(‘.css’, WEAVERX_MINIFY.’.css’,$sheet_dev); // default sheet
            $sheet_file = get_stylesheet_directory() . ‘/style’ . WEAVERX_MINIFY . ‘.css’;
            if (! @file_exists($sheet_file))
                $sheet = $sheet_dev;                    // no style.min.css available (need this check for child themes)

            wp_enqueue_style( ‘weaverx-root-style-sheet’, $sheet, array(‘weaverx-style-sheet’), WEAVERX_VERSION, ‘all’);
        }
    }

    #21778
    Tigermama
    Participant

    Very cool, thank you.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.