Community Forums › Forums › Archived Forums › General Discussion › Help with Hooks
Tagged: custom widget area, Executive
- This topic has 5 replies, 3 voices, and was last updated 10 years, 8 months ago by Brad Dalton.
-
AuthorPosts
-
August 23, 2013 at 3:44 pm #58523htownMember
I am a bit new to StudioPress and WP itself so please bare with me.
I am needing to add an area of text ABOVE the "Home-Top" area of Executive. I have read the page on HOOKS here but not quite understanding it all. I guess I could go and spend a few days reading up on this on the WP.org site but I am hoping this is easier than the page I just mentioned makes it sound. I am afraid I know just enough about coding to be dangerous. May need a little hand holding if it not too much trouble.
I am guessing I am going to need to use the StudioPress hook "genesis_before_content" but I am not sure how to use it. I have modified the copyright and favicon by using code in the functions.php file but that is about as far as I have got modifying anything on the site.
Many thanks,
HoustonAugust 23, 2013 at 3:58 pm #58525htownMemberI found this article and did what it said to the "Executive" template and a new widget area showed up but when I put in a Text field and added some text, it never showed up on the home page.
Many thanks,
HoustonAugust 23, 2013 at 5:28 pm #58536TomParticipantHi Houston,
Executive is structured a little differently that Eleven40 but you can get the same effect. You'll first want to restore home.php and functions.php to roll back your earlier attempts.
Then add this to the bottom of functions.php where the other widgets are registered:
/* register widget above home-top */ genesis_register_sidebar( array( 'id' => 'above-home-top', 'name' => __( 'Above Home Top', 'executive' ), 'description' => __( 'This is after the slider, above the top of the home page.', 'executive' ), ) );
Then, in home.php :
In the section " function executive_home_sections() "
Replace the first 'if' statement with this to add the new above-home-top to this loop:if ( is_active_sidebar( 'home-slider' ) || is_active_sidebar( 'above-home-top' ) || is_active_sidebar( 'home-top' ) || is_active_sidebar( 'home-cta' ) || is_active_sidebar( 'home-middle' ) ) {
Also add this snippet between the similar code blocks for 'slider' and 'home-top'
genesis_widget_area( 'above-home-top', array( 'before' => '<div class="above-home-top widget-area">', ) );
In style.css you'll want to add a line to style this new widget consistent with the other sections:
Add ".above-home-top," (without the quotes) immediately above the lines with
.home-middle, .home-top {
so that it looks like
.above-home-top, .home-middle, .home-top {
I found this at line 538 in style.css. You can also break this out to its own style block to suit the purpose of your new widget area. Mine looked like this:
Have fun with your new widget area.
--
Tom
Choose your next site design from over 350 Genesis themes.
[ Follow me: Twitter ] [ Follow Themes: Twitter ] [ My Favourite Webhost ]August 24, 2013 at 2:18 am #58574Brad DaltonParticipantI'd just use something like this in your child themes functions.php file:
And style by adding to this code in your child themes style.css file:
.welcome-text { font-size: 20px; }
August 24, 2013 at 6:38 am #58583htownMemberThank you Tom and Brad. That did the trick. Many thanks,
Houston
August 24, 2013 at 1:57 pm #58623Brad DaltonParticipant -
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.