• Resolved Vayu Robins

    (@vayu)


    Hi.

    I am creating a child theme based on the Twentyeleven theme. I have no use of the two settings pages that Twentyeleven adds to the admin menu, namely Header (themes.php?page=custom-header) and Backgound (themes.php?page=custom-background). Therefor I would like to somehow deactivate or remove them.

    I have searched the net for a solution, but can’t find any. How can I do this?

    Hope someone can help. ??

    Vayu

Viewing 10 replies - 1 through 10 (of 10 total)
  • There may be a better way to do this, but here is how I go about it. Open your functions.php file and comment out the commands that generate the link you want to remove.

    To remove the Header link, comment out this line:
    add_custom_image_header( 'twentyeleven_header_style', 'twentyeleven_admin_header_style', 'twentyeleven_admin_header_image' );

    To remove the Background link, comment out this line:
    add_custom_background();

    To remove the Theme Options link. comment out this line:
    require( get_template_directory() . '/inc/theme-options.php' );

    I always keep the Widgets and Menus link, so I don’t know about those. I hope this helps.

    Thread Starter Vayu Robins

    (@vayu)

    Hi dbaron.

    Thank you for your tips. ?? I was, however, aware of this solution, but as I am doing a child theme, I would rather not have to edit anything in the parent theme files.

    But maybe there is no other way of doing this?

    Child theme’s functions.php:

    remove_custom_image_header();
    remove_custom_background;
    Thread Starter Vayu Robins

    (@vayu)

    Hi Esmi.

    Thank you for chipping in. ?? This is not working for when I call those 2 function directly in the functions.php file, but I got it working like this:

    add_action( 'after_setup_theme','remove_twentyeleven_options', 100 );
    function remove_twentyeleven_options() {
    
    	remove_custom_background();
    	remove_custom_image_header();
    
    }

    Again, thank you guys for helping out, I appreciate it very much. ??
    Vayu

    How would I modify that last solution if I want to eliminate just the background area around the page? I’m trying to get the page to fill the browser page.
    Any ideas???

    the last solution only applies to the background css properties such as background color or background image – for your question you will need to edit the style.css in your child theme of Twenty Eleven and change the properties of the #page style (as far as i remember).

    please post a link to your site.

    Thread Starter Vayu Robins

    (@vayu)

    Hi WebAuthor5555.

    To me it sounds like your on to something different than what this post is about. Forgive me if I have misunderstood your question, but for that you just wanna change the stylesheet, which is not easily explained here. ??

    Well, some progress.
    Was able to get the top margin and the left margin to shift to where I want them by adding this to the child theme style sheet:

    /* =Structure
    ———————————————– */

    body {
    padding: 0;
    }
    #page {
    margin-top:0;
    margin-bottom:0;
    margin-right:0;
    margin-left:0;
    max-width: 960px;
    }

    /* One column */
    .one-column #page {
    max-width: 960px;
    }
    ===================================
    However, the page shifted to the left, leaving the right margin twice as large as it was.

    It works! Just changed the 960px settings to 1040px and it all fell into place. I ran my video from 800×600 through 1152×860 and it held its own.

    Thanks to you all.

    If you want to get rid of the Theme Options page for Twenty Eleven you can use that code posted by Vayu and add this line:

    remove_action('admin_menu', 'twentyeleven_theme_options_add_page');

    So the whole thing:

    //Remove the custom options provided by the default twentyeleven theme.
    add_action( 'after_setup_theme','remove_twentyeleven_options', 100 );
    function remove_twentyeleven_options() {
    
    	remove_custom_background();
    	remove_custom_image_header();
    	remove_action('admin_menu', 'twentyeleven_theme_options_add_page');
    
    }
Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Remove header and background option pages in twenty eleven child theme’ is closed to new replies.