How Do I Reduce Height of Banner Image?
-
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?
-
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.
Thanks, I just overwrote it with a fresh copy. Thanks for the suggestion.
Might you be so kind as to explain how I should go about doing this with a child theme?
Obviously there’s something I’m misunderstanding on that page you referred me to. I thought I understood it conceptually, though, I’m not sure what I did wrong when I tried to create the child theme.
What’s the foreach() code? Can you post it?
Sure thing, patv.
Here’s the code for the foreach in my header.php file:
<?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'] ); } }?>
@agfreesafety, yes i probably caused more harm than good suggesting you to modify the PHP. Follow esmi’s instructions and create a child theme. I don’t know how to do this myself, but the advantage of creating a child theme is that if something breaks it has a fallback to its parent theme.
In your child theme, create a functions.php file and add the code I mentionned above.
You can’t re-DEFINE a constant in a child without at least triggering a warning (which may or may not be visible). Instead the theme provides a filter than you can use. Try:
// Change header image height function my_new_header_height($height) { $height = 150; return $height; } add_filter( 'wplook_header_image_height', 'my_new_header_height' );
It wouldn’t be a redefinition since it’s not defined yet – he can’t pull that value without getting a error. Thought if esmi’s code works, then use it. I’ve something new today myself ??
since it’s not defined yet
It’s defined in functions/fe/setup.php
In your child theme, create a functions.php file and add the code I mentionned above.
When I selected the new theme (the child I created and placed in the same directory as the Blogolife theme) that I’m using it loses all of the formatting and such that was created via the Blogolife theme.
What might I be doing wrong?
In theory, at least to me, it makes sense that this is happening, because step 3 in the “Example of a basic Child Theme” section on the Child Themes codex page says:
Make a new directory in wp-content/themes, and name it twentyeleven-child (or anything you like).
Save the code below in a file named style.css, and drop this file in the new directory.
Go to Dashboard ? Themes and activate your new theme, the Twenty Eleven Child.My two questions:
1. How can you activate the child theme without DE-activating the current theme? I think that’s what’s going on here.
2. Is my child theme coded correctly?Here are the contents of my style.css that’s tucked into my child theme’s directory on the server:
/* Theme Name: blogolife Child Description: Child theme for the blogolife theme Author: AG Template: blogolife */ define('HEADER_IMAGE_HEIGHT, 150); }
since it’s not defined yet
It’s defined in functions/fe/setup.php
Why wouldn’t it be detecting it then?
You can’t re-DEFINE a constant in a child without at least triggering a warning (which may or may not be visible). Instead the theme provides a filter than you can use. Try:
// Change header image height
function my_new_header_height($height) {
$height = 150;
return $height;
}
add_filter( ‘wplook_header_image_height’, ‘my_new_header_height’ );@esmi – are you suggesting that I clear out what I put in the style.css I created for the child theme, and replace it with what you provided above?
If so, won’t it remove the formatting from the Blogolife theme I’m using once I select my child theme from within the wordpress admin panel?
are you suggesting that I clear out what I put in the style.css I created for the child theme, and replace it with what you provided above?
No. First, try adding the code I gave above to a functions.php file in your child theme. If you don’t already have such a file, create one using a plain text editor.
No. First, try adding the code I gave above to a functions.php file in your child theme. If you don’t already have such a file, create one using a plain text editor.
Ok, I created a functions.php and placed it in my child theme’s folder. My site is still unformatted, because I had to activate the child theme according to the instructions on the codex page for making child themes.
Two questions:
1. How can you activate the child theme, yet keep the main theme activated, to keep the page displaying your site using the formatting from your main theme at the same time? How can you have two themes active at the same time?
2. Below are the contents of the functions.php file I have in my child theme’s folder. Does it have everything it needs in it, or do I need to add something?
<?php // Change header image height function my_new_header_height($height) { $height = 150; return $height; } add_filter( 'wplook_header_image_height', 'my_new_header_height' ); ?>
@agfreesafety
If you want to reduce the banner height then add this line in function.php file of your theme.define( ‘HEADER_IMAGE_HEIGHT’, apply_filters( ‘twentyeleven_header_image_height’, 300 ) );
@agfreesafety
If you want to reduce the banner height then add this line in function.php file of your theme.define( ‘HEADER_IMAGE_HEIGHT’, apply_filters( ‘twentyeleven_header_image_height’, 300 ) );
Thanks! That fixed it. How would I reduce the vertical size of the banner above it? I’d image that the code would be similar.
OK, I’m trying to figure out my last question on my own. I noticed the the div id above the header image when I highlighted it using Firebug was called “header image.”
I highlighted the other portion of the header that I’m trying to reduce (just above the banner), and noticed that the div id above that portion of code is labelled “page.”
So I tried to put “two and two together”, and that that I would enter the following into the functions.php:
define( 'PAGE_HEIGHT', apply_filters( 'twentyeleven_page_height', 300 ) );
Unfortunately, nothing happened.
Am I close? I’m trying to make that top part of the banner as small as I can to increase the amount of information a site visitor can see “above the fold.”
- The topic ‘How Do I Reduce Height of Banner Image?’ is closed to new replies.