• Resolved Eric

    (@1968eric)


    I am creating a child theme for Twentytwelve as the parent.

    I want to remove the Dashboard options to change the header and background.

    I managed to come up with the following code, it doesn’t crash the site, and it accomplishes what I intended without breaking anything (that I have discovered so far) but I want to make sure I am writing the code properly.

    What is the correct way to write the following?

    <?php
    
    function twentytwelvechild_remove_custom_appearance() {
    remove_theme_support( 'custom-background' );
    remove_theme_support( 'custom-header' );
    }
    add_action( 'after_setup_theme', 'twentytwelvechild_remove_custom_appearance', 11 );
    
    ?>

    That is the entire contents of my child’s functions.php

Viewing 5 replies - 1 through 5 (of 5 total)
  • Your PHP looks all right to me! What are you asking (more specifically)?

    I can’t see anything wrong with the above code. ??

    Thread Starter Eric

    (@1968eric)

    Oh, I thought it might be wrong to repeat

    remove_theme_support

    When I try

    remove_theme_support(  'custom-background', 'custom-header'  );

    It either breaks or the header removing doesn’t work.

    Shouldn’t I just have to write that once and be able to put both the background and header things in there?

    I guess if it doesn’t break anything, and it doesn’t appear to be, it doesn’t matter.

    Thanks to you both.

    Nope. It’s correct AFAIK. Happy coding!

    Thread Starter Eric

    (@1968eric)

    Thanks again

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Child theme code for removing background and header’ is closed to new replies.