• Resolved rekabis

    (@rekabis)


    Fresh and clean install of 3.8 with just a few blog posts moved over to it and Better WP Security installed.

    When using the Skeleton theme, and making use of a child theme, the remove_theme_support methods do not work at all. I want to remove all CSS brought in via the Theme Options in the control panel. That is, the internal CSS that you actually see between the <head></head> tags. Not the external or inline CSS, the internal CSS that sits betwen <style></style> tags within the head, and which is specified by the Theme Options page when you click on a theme in the WP control panel.

    My child theme’s functions.php looks like this:

    function child_after_setup_theme(){
        remove_theme_support( 'custom-header' );
        remove_custom_image_header();
        remove_theme_support( 'custom-background' );
        remove_custom_background();
        remove_theme_support( 'post-formats' );
    }
    add_action('after_setup_theme', 'child_after_setup_theme', 11 );
    
    function remove_skeleton_theme_options() {
        remove_submenu_page('themes.php', 'theme_options');
    }
    add_action('admin_init', 'remove_skeleton_theme_options', 11 );

    I have even tried to add

    add_action('after_setup_theme', 'remove_theme_features', 11 );
    
    function remove_theme_features() {
        $GLOBALS['custom_background']   = 'kill_theme_features';
        $GLOBALS['custom_image_header'] = 'kill_theme_features';
    }
    class kill_theme_features {
        function init() { return false; }
    }

    But this also did nothing, and

    add_action('after_setup_theme', 'remove_custom_background');
    
    function remove_custom_background() {
    	global $_wp_theme_features;
    	unset($_wp_theme_features['custom-background']);
    }

    Killed my entire site (blank page, both front-end and back-end).

    Suggestions?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter rekabis

    (@rekabis)

    Update: I cannot remove the CSS brought in via the Theme Options even when I put

    remove_theme_support( 'custom-header' );
        remove_custom_image_header();
        remove_theme_support( 'custom-background' );
        remove_custom_background();
        remove_theme_support( 'post-formats' );

    directly into the parent theme’s functions.php in the correct place. That is, within a block that has add_theme_support calls and fires the add_action('after_setup_theme' …); function initiator.

    Thread Starter rekabis

    (@rekabis)

    Update: Even adding the whole

    add_action('after_setup_theme', 'child_remove_skeleton_after_setup_theme' );
    function child_remove_skeleton_after_setup_theme(){
        remove_theme_support( 'custom-header' );
        remove_custom_image_header();
        remove_theme_support( 'custom-background' );
        remove_custom_background();
        remove_theme_support( 'post-formats' );
    }

    as its own section to the parent theme’s function.php does not achieve the desired result. The internal CSS from the Theme Options is still in place.

    Thread Starter rekabis

    (@rekabis)

    Just confirmed something very, very strange:

    The string ‘automatic-feed-links’ works when used with remove_theme_support, but the other three do not. As in, when I put into my child theme
    remove_theme_support( 'automatic-feed-links' );
    the rss feeds vanish out of the <head>, no different than if I were to remove the line that adds them in the parent theme’s functions.php. However, adding the other three lines to either functions.php (child or parent) fails to achieve the same result wrt the internal CSS.

    If you’re using Skeleton 2, you can remove the theme options styles from wp_head in a child theme like so:

    add_action('wp_head','remove_skeleton_styles',1);
    
    function remove_skeleton_styles() {
    	remove_action('wp_head','skeleton_options_styles');
    }

    The other actions you’re referring to are from the native WP theme customizer. Skeleton has its own theme option controls at Appearance → Theme Options.

    Not sure what you’re trying to achieve, but if you want to remove the theme options from client view, you could add this to your child theme as well:

    function optionsframework_add_page() {
    	// Commenting out the line below removes the theme options from view.
    	//$of_page = add_theme_page( __('Theme Options', 'options_framework_theme'), __('Theme Options', 'options_framework_theme'), 'edit_theme_options', 'options-framework','optionsframework_page' );
    
    	// Load the required CSS and javscript for later use?
    	add_action( 'admin_enqueue_scripts', 'optionsframework_load_scripts' );
    	add_action( 'admin_print_styles', 'optionsframework_load_styles' );
    }
    Thread Starter rekabis

    (@rekabis)

    Thank you very much for your help!

    The thing is, all the instructions I have found to date have led me to believe that the Theme Options for any theme were controlled by the code I used above in my first post (remove_theme_support()). I did not find any indications that a theme’s Theme Options were to be disabled in an entirely different way.

    I have used your code, and have confirmed that it works brilliantly. I am just curious if someone could post links to relevant documentation that would normally lead someone to logically infer SimpleThemes’ code; especially in relation to the Theme Options present in a theme. I have been strip-searching Google for about a day now, and have found nothing beyond the usage of remove_theme_support(), so I am somewhat distressed at this apparent failure of my Google-fu.

    Thank you for your assistance, SimpleThemes! It was greatly appreciated.

    add_theme_support() and remove_theme_support() simply enables/disables the core WP features to be used. There is also a good bit of PHP and CSS that goes on afterward which specifies usage and deals with the callbacks in hooking it all into a theme.

    http://codex.wordpress.org/Function_Reference/add_theme_support

    As you can see the options and parameters are fairly limited. The theme options framework in Skeleton is much more robust in that it controls a lot more functionality – such as typography colors, fonts, font-weights, specified element backgrounds, and basic feature enabling via UI.

    That said, if you copy options.php into your parent theme, you can add your own options and if you like, write the functionality into your child theme via it’s actions hooks.

    Hope this helps.

    Thread Starter rekabis

    (@rekabis)

    It most certainly does help. Thank you very much. You have yourself a devoted customer here, and I will be sure to pick up one of your paid themes once my funding permits it.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘remove_theme_support is not working.’ is closed to new replies.