WordPress.org

Ready to get started?Download WordPress

Forums

Header on Static Front Page and Pages but not Post Page (3 posts)

  1. Sentosa1
    Member
    Posted 1 year ago #

    I'm a beginner at html however I have managed to achieve most of what I wanted on my website http://eastwick-jun.surrey.sch.uk EXCEPT for one thing and that is I cannot appear to change the theme to display the header on my blog/index page which I call News. From what I can work out the function.php has code in it that determines where the header is shown in that it states:

    //custom header
    $pandora_rand_img = rand(1,3);
    define('NO_HEADER_TEXT', true );
    define('HEADER_IMAGE', '%s/images/custom-header'.$pandora_rand_img.'.jpg'); // %s is the template dir uri
    define('HEADER_IMAGE_WIDTH', 1000); // use width and height appropriate for your theme
    define('HEADER_IMAGE_HEIGHT', 200);
    //define('HEADER_IMAGE', trailingslashit( get_stylesheet_directory_uri() ).'images/banner.jpg');
    	// gets included in the site header
    function pandora_header_style() {
                    if ( !is_home() ) {
    		if ( get_header_image() != '' ){
    			$pandora_header_height = "height:200px";
    			$pandora_header_width = "width:1000px";
    		}
    		?><style type="text/css">
    			#header {
    				background: url(<?php header_image(); ?>);
    				<?php print $pandora_header_height ?>;
    				<?php print $pandora_header_width ?>;
    			}
    		</style><?php
    	}
    }

    if I change the line
    if ( !is_home() ) {
    to
    if ( is_home() ) {
    the header will just display on the News page and none of the others!

    I would be grateful if I could be given the code, and where it should be put, to ensure that my header appears on every page of my site!

    The theme is Pandora which I have customized.

    Thank you in advance.

  2. deepbevel
    Member
    Posted 1 year ago #

    The code is telling it to display on all pages except home.
    You could try removing

    if ( !is_home() ) {

    and the second closing " } " directly after

    <?php print $pandora_header_width ?>;
  3. Sentosa1
    Member
    Posted 1 year ago #

    Thank you thank you thank you!! You know where I went wrong I hadn't understood about the "}"
    To add to it there was a second "}" for some reason after that and when I got rid of that it worked!!

    Thankyou so much I really appreciate it and had looked on line for ages!

Topic Closed

This topic has been closed to new replies.

About this Topic