Be careful when adding Genesis framework widget areas.
If you damage a PHP file your website will stop working and all you will be able to see is a white screen. So you need to access, replace or repair your PHP files using FTP.
Do not try edit any PHP files until you can use FTP to backup, repair and replace any files you may damage.
Adding Genesis Framework widget areas the easy way
This post was originally based on a code snippet provided by Brian Gardner. Brian has since redesigned his site, however you can use the code below. To find more code snippets by Brian visit his code snippets page.
Don’t try use this code in the eleven40 StudioPress theme.You can not use this exact code with the eleven40 StudioPress theme. It’s already built into that theme. If you try add the code again to the eleven40 theme your site will stop working!You can not re-declare a function that is already in use.
There are two pieces of PHP code and one piece of CSS code.
Paste both pieces of PHP code into your StudioPress theme’s functions.php file.
Paste the CSS code into your StudioPress theme’s style.css file.
You can find the code editor in your WordPress dashboard…
Dashboard > Appearance > Editor.
On the right hand side of your screen look for Theme Functions functions.php
Styles Stylesheet style.css.
We’re using the code displayed below, put the PHP code in functins.php and the style sheet code in style.css.
Save your chages.
This code originally came from Brian Gardner’s website, it should look something like this…
The PHP code. Place this in your StudioPress theme’s functions.php file…
Code for older themes
Code for HTML5 themes
The CSS code. Place this in your your StudioPress theme’s theme’s style.css file……
(Same on old and new themes)
After you’ve pasted both pieces of PHP code into the bottom of your your StudioPress theme’s functions.php file. Making sure you get them in the right order. And you’ve pasted the CSS into your your StudioPress theme’s style.css file… In your WordPress dashboard, go to Appearance > Widgets. Click the down arrow to open the widget called Welcome Text. Drag a text widget in to this widget area. Type a message that you want to appear on every page of your site. Click save. You now have a new widget area at the top of all pages and posts on your site. You can use it to display text, images or a slider etc. If you use this widget area to display a slider or any widget other than the text widget, you may want to edit the css to achieve a look that suits your site’s design.
If you want to only display your widget and it’s content on your home page you need to use some conditional code.
Go to… Dashboard > Appearance > Editor. On the right hand side of your screen look for Theme Functions functions.php Find the widget area code we added to the site and type some conditional code just before where it says genesis_widget_area. Save your file and check that your widget only appears on the front page of the site. If you want to choose where on your page the widget appears, top, bottom, left or right etc. you will need to change the hook the that is used in the code. Go to genesis tutorials .com and find the visual hook guide page. http://genesistutorials.com/visual-hook-guide/ Look through all of the available hooks and find a hook that is in the position you want to place your content. Copy the hook name. Open Your theme’s functions.php file. Dashboard > Appearance > Editor. On the right hand side of your screen look for Theme Functions functions.php Find the part of the code that says add_action…
The code in single quotes that comes after add_action( is the hook.
By changing the name of the hook you will move the widget area to a different part of your web page.
You’re well on your way to being a Genesis Framework widget area, and StudioPress super hero!
Looking for a StudioPress theme or hosting?
Check out the two links below…
When you sign up for a WP Engine plan, you receive the Genesis Framework and 36 StudioPress Themes free. That’s over $2,000 in value.
Buy a StudioPress theme outright and use it on all of your sites. There are three ways to get all of the StudioPress themes AND save.