Custom Header and Background for Single Page
-
Hi there!
I’m absolutely in love with this theme, it’s beautiful and easy to customize, thank you for making such an awesome theme free!
So I am having an issue because I have my whole site laid out and ready to go, but I would like one page to have a custom background and header.
The site is: http://www.audrey-shore.com and the page I would like to have a custom background and header is: http://www.audrey-shore.com/spiritual-virtual-assistant
[Moderator Note: Please ensure that you are embedding links correctly in your posts. Links corrected.]
I am a complete novice when it comes to code so the less complex the solution is the better!
Thanks so much!
Audrey
-
Hi there Audrey,
For some reason we can’t see your links. Could you post them again?
You can create a custom background image or color on a single page with some simple CSS rules.
However, in order to create a custom header for just one page you’ll need to work with php.
The first thing I recommend, if you haven’t already done so, is setting up a child theme. Child themes are the safest way to go when doing any kind of customizations.
You can read about setting up a child theme here.
Hopefully we can help you more π
– Luke
Weird…they still didn’t post, hang on! http://www.audrey-shore.com and http://www.audrey-shore.com/spiritual-virtual-assistant
They should have worked that time, if you’re still having trouble let me know!
Ok, I’m in the process of making the child theme, when you get a chance would you mind letting me know what I should do next?
If you didn’t get the links again they are http://www.audrey-shore.com and http://www.audrey-shore.com/spiritual-virtual-assistant
The home page to the site doesn’t have anything on it yet, which is why you aren’t seeing anything, but the second link has content.
Thank you so much for all your help! I’m excited to get this working!
Audrey
Hi!
So I created a child theme, but it’s not importing the style.css of the parent theme, the website is a subdomain and the theme is installed on a couple of different subdomains within the main domain. Could that be the problem?This is my code in the child theme style.css
/* Theme Name: Sugar and Spice Child Template: sugar-and-spice Version: 1.0.0 Text Domain: sugar-and-spice-child */ @import url("..http://fairyatheart.com/Audrey-Shore/wp-content/themes/sugar-and-spice/style.css"); /* =Theme customization starts here -------------------------------------------------------------- */Aaah I’m ready to pull my hair out…so looking forward to putting this behind me! Thanks!
Sorry, I know I’m sure I’m spamming your inbox at this point. I’m just trying to figure things out, when you make a child theme, you don’t copy all the files from the previous theme, you just create style.css and put in code for it to pull the style.css of the template theme, and then add whatever customizations for it to load after the parent theme right?
I’m just trying to figure out what’s up. Thank you!
Hi Audrey,
When you create a child theme you don’t need to copy the style.css file just link to it as you are doing with the @import function.
I think your problem could be the two dots at the beginning of the url. This is used to jump up to a higher level folder but since you are using the full url its unneseccary.
This should be all you need:
@import url("../sugar-and-spice/style.css")Also, check that the name of your child theme folder is exactly the same as what is written besides your ‘Text Domain’.
It won’t make any difference whether or not you are using subdomains as long as you have the parent theme installed in your current installation of wordpress and have your child theme activated.
Is this page http://www.audrey-shore.com/spiritual-virtual-assistant
the one you want to change the background and header on? If so, do you want a background image or a different color (so I can give you the correct CSS) ?
I hope that gets your child theme sorted π
– Luke
Yes, that’s the page! I’d like to do a background image and a new header image. Thank you so much!
So the child theme still isn’t working, this is the code that I have in style.css right now…does everything look good? This is all I have in my style.css and the text domain is exactly the same…I’m stumped!
/* Theme Name: Sugar and Spice Child Template: sugar-and-spice Version: 1.0.0 Text Domain: Sugar-and-Spice-Child */ @import url("../sugar-and-spice/style.css"); /* =Theme customization starts here -------------------------------------------------------------- */The code looks fine Audrey.
Is the child theme appearing in your Appearance -> Themes area on your dashboard?
If so, what happens when you try to activate it?
Do note that you’ll probably need to reset the header images and menus, as with any theme change.
Your site looks different now…maybe you did it ? π
– Luke
Here is the css you’ll need to place in your child theme to change the background on the ‘Spiritual Virtual Assistant’ page..
.page-id-60 { background-image: url("http://") !important; }Change the url to the path of your background image.
Ok, I’m still having some serious trouble with the child theme, it’s not loading any of the styles….I just don’t know.
I switched back the theme so the css should be back to normal now. Thank you so much for the background image….what would the css be for the header image? And do you have any idea what’s up with the child theme?
Thanks for all your help!
-Audrey
Hello!
I usually use One Click Child Theme to generate child themes. I think you should give it a try.
Hi,
I just tried this out and it’s working well for me:
To have a custom header image on just one page you can use this plugin:
WP Display Header
but….
You’ll need to make some changes to your header.php file. To include this in your child theme you’ll need to:
1. Copy all the code from your header.php in your parent theme.
2. Paste it into a new file called header.php in your child theme folder.
3. Look for this code:<?php if (of_get_option('logo_image')) : ?> <a>" class="logo-img"><img src="<?php echo esc_attr( of_get_option('logo_image') ); ?>" alt="<?php bloginfo( 'name' ); ?>" /></a> <?php else : ?> <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1> <h2 class="site-description"><?php bloginfo( 'description' ); ?></h2> <?php endif; ?>4. Delete it and replace it with:
<img src="<?php header_image(); ?>" height="<?php echo get_custom_header()->height; ?>" width="<?php echo get_custom_header()->width; ?>" alt="" />5. Create a new file in your child theme folder called ‘functions.php’ and place this code inside it:
<?php add_theme_support( 'custom-header' ); ?>6. Go to your Dashboard – Plugins -> Add New and search for WP Display Header. Install and activate.
7. Go to your Appearance –> Header and upload the header image file you want to use on your front page and click ‘Choose Image’.
7. Repeat the process and upload the image file you want to use on your ‘Spiritual Virtual Assistant’ page but DON’T click ‘Choose Image’.
8. Instead, go to your Dashboard – > Pages and click ‘Edit’ under your ‘Spiritual Virtual Assistant’ page.
9. Scroll to the bottom and you should see a box called ‘Header’ and be able to click the radio icon next to the image you want to use.
10. Click update and you should have a custom header on just that particular page.
As regards your child theme, these are the exact steps I took to set it up:
1. Create a new folder in wp-content/themes/ called
sugar-and-spice-child
2. Create a new file called ‘style.css’ and paste in the following code:
/* Theme Name: Sugar and Spice Child Theme URI: http://example.com/twenty-fourteen-child/ Template: sugar-and-spice Version: 1.0.0 Text Domain: sugar-and-spice-child */ @import url("../sugar-and-spice/style.css"); /* =Theme customization starts here -------------------------------------------------------------- */ .page-id-4 { background-image: url("http://subtlepatterns.com/patterns/congruent_outline.png") !important; }3. Dashboard – Appearance -> Themes & Activate ‘Sugar and Spice Child’
If could be that you set some styles under – Appearance -> Theme Options and you just have to apply those again in your child theme.
I hope that helps you out π
– Luke
Awesome, I’m getting everything to work, except for the fact that for some reason when I add the header on the “spiritual virtual assistant” page, it comes in on every page, and the dimensions are way off.
Any ideas?
Thanks!
-Audrey
The topic ‘Custom Header and Background for Single Page’ is closed to new replies.
