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. As per comments: this is what the Customizer API is for. In the case of the header there are a dozen parameters to tweak the behaviour with. Like this:

    $defaults = array(
        'default-image'          => '',
        'width'                  => 0,
        'height'                 => 0,
        'flex-height'            => false,
        'flex-width'             => false,
        'uploads'                => true,
        'random-default'         => false,
        'header-text'            => true,
        'default-text-color'     => '',
        'wp-head-callback'       => '',
        'admin-head-callback'    => '',
        'admin-preview-callback' => '',
    );
    add_theme_support( 'custom-header', $defaults );