How to make theme elements customizable in wordpress?

In WordPress there’s a menu option called ‘Appeareances’.
I want to add (e.g.) a submenu ‘header’ there and then be able to customize the header from within wordpress (administration page).

From what I understood I have to have a ‘functions.php’ file in my theme folder. In the ‘functions.php’ file I write something like this:

Read More
<?php add_submenu_page( $parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function); ?>

Of course with adapted arguments (which I’m not entirely sure what those should be since I feel quite lost in all this).

Related posts

Leave a Reply

1 comment

  1. CODEX is your best friend ..

    And like the codex say, if you want to add an entry to the 'Appearance' menu , use

    For Appearance: add_submenu_page( ‘themes.php’, … );

    or adapted to your case :

    add_submenu_page( 'themes.php', 'Header', 'Header', 'edit_theme_options', 'customize_header','my_callback');
    

    But ..:

    Also see
    > add_theme_page()
    

    like so :

     add_theme_page( $page_title, $menu_title, $capability, $menu_slug, $function );
    

    Quoting from codex :

    Parameters

    $page_title
    (string) (required) The text to be displayed in the title tags of the page when the menu is selected

        Default: None 
    

    $menu_title
    (string) (required) The text to be used for the menu

        Default: None 
    

    $capability
    (string) (required) The capability required for this menu to be displayed to the user.

        Default: None 
    

    $menu_slug
    (string) (required) The slug name to refer to this menu by (should be unique for this menu).

        Default: None 
    

    $function
    (callback) (optional) The function to be called to output the content for this page.

    TL;DR version

    All the above said in general for custom menu entries, but in the specific case of custom header, all you actually need to use is :

    add_theme_support( 'custom-header' );
    

    See details here : http://codex.wordpress.org/Custom_Headers