WordPress.org

Support

Support » How-To and Troubleshooting » How Do I Reduce Height of Banner Image?

How Do I Reduce Height of Banner Image?

  • agfreesafety
    Member

    @agfreesafety

    I don’t have the HEADER_IMAGE_HEIGHT value in my Functions.php file mentioned here.

    I don’t have the add_filter value referenced in this blog post in my functions.php file.

    I read this forum post here on WordPress, which says that I should be able to reduce the size of my banner image from within WordPress itself. I have the latest version installed; if that’s the case, then where do I make that modification?

Viewing 15 replies - 1 through 15 (of 29 total)
  • agfreesafety
    Member

    @agfreesafety

    Oh, by the way, here is the site I’m currently working on.

    You should be able to (re)defined constants in your functions.php, no?

    define('HEADER_IMAGE_HEIGHT, 150)

    can’t do with css ?

    esmi
    Forum Moderator

    @esmi

    This is far better done via a child theme.

    agfreesafety
    Member

    @agfreesafety

    patv,

    I get this error when I try to save my changes after adding that line to the end of my functions.php file.

    agfreesafety
    Member

    @agfreesafety

    esmi,

    Thanks for answering. I have an I.T. background, but I’m a little intimidated by going through the steps required to create a child theme, but I’m reading through what you provided to see just how complex that is to do.

    Thanks

    You might have to set the line within a function, such one that is triggered when WordPress is being loaded upon a page request. I can’t seem to find the action hook for you, but if you look around in the codex you probably will be able to find it.

    agfreesafety
    Member

    @agfreesafety

    esmi,

    After adding patv’s suggested code via a child theme (named custom blogolife), which I placed at the root theme folder and activated it from within WordPress.

    Here’s what the syle.css looks like:

    /*
    Theme Name: blogolife Child
    Description: Child theme for the blogolife theme
    Author: AG
    Template: blogolife
    */
    
    define('HEADER_IMAGE_HEIGHT, 150);
    }

    @agfreesafety, the code i sent you is PHP, so it has to be set in the functions.php file. It won’t get recognized in a .css file.

    agfreesafety
    Member

    @agfreesafety

    Sorry, I meant to add that this is what I’m getting when I try to visit my URL

    What’s the foreach() code? Can you post it?

    agfreesafety
    Member

    @agfreesafety

    You might have to set the line within a function, such one that is triggered when WordPress is being loaded upon a page request. I can’t seem to find the action hook for you, but if you look around in the codex you probably will be able to find it.

    @agfreesafety, the code i sent you is PHP, so it has to be set in the functions.php file. It won’t get recognized in a .css file.

    Is it possible that you could give me an example of how this might be done?

    I’m all for stretching my comfort zone (thanks to esmi), however I’m searching through codex currently, and I’m a little lost 🙁

    agfreesafety
    Member

    @agfreesafety

    I can’t access my webpage anymore.

    When I tried to access my site 5 minutes ago, I got an error.

    Now when I try, I get this error.

    If you can help me get rid of this error, it would be appreciated, I’d just have to deal with the tall header image, as I didn’t know it would be this much work to make it shorter 🙂

    Please help. Thanks

    agfreesafety
    Member

    @agfreesafety

    By the way, here’s the contents of the header.php file. I have no idea what is going on here.

    <?php
    /**
     * The header template
     *
     * @package wplook
     * @subpackage BlogoLife
     * @since BlogoLife 1.0
     */
    ?>
    <?php global $options;
    foreach ($options as $value) {
    	if (isset($value['id']) && get_option( $value['id'] ) === FALSE && isset($value['std'])) {
    		$$value['id'] = $value['std'];
    	}
    	elseif (isset($value['id'])) { $$value['id'] = get_option( $value['id'] ); }
    }?>
    <!DOCTYPE html>
    <html <?php language_attributes(); ?>>
    <head>
    <meta charset="<?php bloginfo( 'charset' ); ?>" />
    <title><?php global $page, $paged;
    	wp_title( '', true, 'right' );
    	// Add the blog description for the home/front page.
    	$site_name = get_bloginfo( 'name', 'display' );
    	if ( $site_name && ( is_home() || is_front_page() ) )
    		echo " $site_name";
    	// Add a page number if necessary:
    	if ( $paged >= 2 || $page >= 2 )
    		echo ' | ' . sprintf( __( 'Page %s', 'wplook' ), max( $paged, $page ) );
    	?></title>
    <?php wplook_meta_description();?>
    
    <meta name="keywords" content="<?php echo $wpl_meta_keywords; ?>" />
    <link rel="shortcut icon" href="<?php echo $wpl_favicon_url; ?>" />
    <link rel="apple-touch-icon" href="<?php echo get_template_directory_uri() ?>/images/apple-touch-icon.png" />
    <?php if ( is_singular() ) wp_enqueue_script( "comment-reply" ); ?>
    <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
    <?php echo stripslashes($wpl_ga_code); ?>
    <?php wp_head(); ?>
    	</head>
    <body <?php body_class('two-column right-sidebar'); ?>>
    <div id="page"<?php if (is_single() || is_page() ) { $sidebar = get_post_meta($post->ID,'wpl_enable_sidebar',true);  if($sidebar=="false") echo ' class="template-full-widch"'; } ?>>
    	<header id="branding">
    <hgroup class="fleft">
    	<h1 id="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?> - <?php bloginfo('description'); ?>" rel="home"><?php bloginfo('name'); ?></a></h1>
    	<h2 id="site-description"><?php bloginfo('description'); ?></h2>
    </hgroup>
    <div class="header-desc fright"><p><?php echo stripslashes($wpl_header_desc); ?></p></div>
    <div class="clear"></div>
    <div class="social-icons fright">
    
    <?php if ($wpl_twitter != '') { ?>
    <a href="<?php echo $wpl_twitter; ?>" target="_blank" title="<?php _e('Twitter', 'wplook'); ?>"><img src="<?php echo get_template_directory_uri(); ?>/images/icons/twitter.png" width="22" height="22" /></a>
    <?php } ?>
    <?php if ($wpl_google_plus != '') { ?>
    <a href="<?php echo $wpl_google_plus; ?>" target="_blank" title="<?php _e('Google +', 'wplook'); ?>"><img src="<?php echo get_template_directory_uri(); ?>/images/icons/google-plus.png" width="22" height="22" /></a>
    <?php } ?>
    <?php if ($wpl_facebook != '') { ?>
    <a href="<?php echo $wpl_facebook; ?>" target="_blank" title="<?php _e('FaceBook', 'wplook'); ?>"><img src="<?php echo get_template_directory_uri(); ?>/images/icons/facebook.png" width="22" height="22" /></a>
    <?php } ?>
    <?php if ($wpl_linkedin != '') { ?>
    <a href="<?php echo $wpl_linkedin; ?>" target="_blank" title="<?php _e('Linkedin', 'wplook'); ?>"><img src="<?php echo get_template_directory_uri(); ?>/images/icons/linkedin.png" width="22" height="22" /></a>
    <?php } ?>
    <?php if ($wpl_tumblr != '') {	?>
    <a href="<?php echo $wpl_tumblr; ?>" target="_blank" title="<?php _e('Tumblr', 'wplook'); ?>"><img src="<?php echo get_template_directory_uri() ?>/images/icons/tumblr.png" width="22" height="22" /></a>
    <?php } ?>
    <?php if ($wpl_delicious != '') {	?>
    <a href="<?php echo $wpl_delicious; ?>" target="_blank" target="_blank" title="<?php _e('Delicious', 'wplook'); ?>"><img src="<?php echo get_template_directory_uri() ?>/images/icons/delicious.png" width="22" height="22" /></a>
    <?php } ?>
    <?php if ($wpl_digg != '') {	?>
    <a href="<?php echo $wpl_digg; ?>" target="_blank" title="<?php _e('Digg', 'wplook'); ?>"><img src="<?php echo get_template_directory_uri() ?>/images/icons/digg.png" width="22" height="22" /></a>
    <?php } ?>
    <?php if ($wpl_stumbleupon != '') {	?>
    <a href="<?php echo $wpl_stumbleupon; ?>" target="_blank" title="<?php _e('Stumbleupon', 'wplook'); ?>"><img src="<?php echo get_template_directory_uri() ?>/images/icons/stumbleupon.png" width="22" height="22" /></a>
    <?php } ?>
    <?php if ($wpl_flickr != '') {	?>
    <a href="<?php echo $wpl_flickr; ?>" target="_blank"  title="<?php _e('Flickr', 'wplook'); ?>"><img src="<?php echo get_template_directory_uri() ?>/images/icons/flickr.png" width="22" height="22" /></a>
    <?php } ?>
    <?php if ($wpl_picasa != '') {	?>
    <a href="<?php echo $wpl_picasa; ?>" target="_blank" title="<?php _e('Picasa', 'wplook'); ?>"><img src="<?php echo get_template_directory_uri() ?>/images/icons/picasa.png" width="22" height="22" /></a>
    <?php } ?>
    <?php if ($wpl_youtube != '') {	?>
    <a href="<?php echo $wpl_youtube; ?>" target="_blank" title="<?php _e('YouTube', 'wplook'); ?>"><img src="<?php echo get_template_directory_uri() ?>/images/icons/youtube.png" width="22" height="22" /></a>
    <?php } ?>
    <?php if ($wpl_dribbble != '') {	?>
    <a href="<?php echo $wpl_dribbble; ?>" target="_blank" title="<?php _e('Dribble', 'wplook'); ?>"><img src="<?php echo get_template_directory_uri() ?>/images/icons/dribbble.png" width="22" height="22" /></a>
    <?php } ?>
    <?php if ($wpl_rss != '') { ?>
    <a href="<?php echo $wpl_rss; ?>" target="_blank" title="<?php _e('Subscribe to RSS', 'wplook'); ?>"><img src="<?php echo get_template_directory_uri() ?>/images/icons/rss.png" width="22" height="22" /></a>
    <?php } ?>
    </div><div class="clear"></div>
    </header>
    
    <?php if ($wpl_menu == '' || $wpl_menu == 'Display') { ?>
    <nav>
    	<?php wp_nav_menu( array('depth' => '3', 'theme_location' => 'primary' )); ?>
    	<div class="left-corner"></div>
    	<div class="right-corner"></div>
    </nav>
    <?php } ?>
    <div id="header-image">
    <?php
    				//Code from 2011 theme by wordpress theme team
    				//Check to see if the header image has been removed
    				$header_image = get_header_image();
    				if ( ! empty( $header_image ) ) :	?>
    <a href="<?php echo esc_url( home_url( '/' ) ); ?>">
    				<?php
    					// The header image
    					// Check if this is a post or page, if it has a thumbnail, and if it's a big one
    					if ( is_singular() &&
    							has_post_thumbnail( $post->ID ) &&
    							( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( HEADER_IMAGE_WIDTH, HEADER_IMAGE_WIDTH ) ) ) &&
    							$image[1] >= HEADER_IMAGE_WIDTH ) :
    						// Houston, we have a new header image!
    						echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
    					else : ?>
    <img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" />
    				<?php endif; // end check for featured image or standard header ?>
    			</a>
    			<?php endif; // end check for removed header image ?>
    			<?php // Has the text been hidden?
    				if ( 'blank' == get_header_textcolor() ) :
    			?>
    <?php endif; ?>
    </div>
    <div id="main">

    esmi
    Forum Moderator

    @esmi

    Re-upload a fresh copy of the theme to wp-content/themes using FTP or whatever file management application your host provides.

    This is another reason why you should always use a child theme.

Viewing 15 replies - 1 through 15 (of 29 total)
  • The topic ‘How Do I Reduce Height of Banner Image?’ is closed to new replies.