WordPress Twenty-Fourteen: How to Select a Different Header Image for Pages

Although I have succeeded in creating the exact look and functionality I want for my Home Page, and everythings works OK, but I have no control over changing or deleting the header image and background color in my other pages linked to the Home Page.

I have written all the code for and have only these files now in my AAB named theme folder: style.css, content-page.php, functions.php, header.php, and index.php

How can I learn how to solve this problem, or please tell me what code or other files or modifications do I need now to proceed further? To the best of my beginner’s knowledge, my problems might be fixed by adding some additional code to header.php.

What I think I need to know is how to create an “if…then…else” structure to specify the header image displayed on linked pages.

Below is my header.php file contents:

<!DOCTYPE html>
<html <?php language_attributes(); ?>>
    <head>
        <meta charset="<?php blog_info('charset'); ?>">
        <meta name="viewport" content="width=device-width">
        <title><?php bloginfo('name'); ?></title>
        <?php wp_head(); ?>
    </head>
</html>

<body <?php body_class(); ?>>

   <!-- site-header -->
   <header class="site-header">
    <a href="http://localhost/wordpress/?page_id=7" target="'home-   page'";>
    <img src="http://localhost/wordpress/wp-content/uploads/Cropped-    Front.tekst_-original.gif"; width="100%";";>
   </a>
   </header>

/* 2017 Mar 28 added the following code to my functions.php to allow         support for "custom Headers"*/

add_theme_support( 'custom-header' );

/* Note that you can add default arguments using: */

$defaults = array(
    'default-image'          => '',
    'width'                  => 100,
    'height'                 => 100,
    'flex-height'            => true,
    'flex-width'             => true,
    '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', $header_args );

Read more here: WordPress Twenty-Fourteen: How to Select a Different Header Image for Pages

Leave a Reply

Your email address will not be published. Required fields are marked *