Help with Hooks

Community Forums Forums General Discussion Help with Hooks

This topic is: not resolved

This topic contains 5 replies, has 3 voices, and was last updated by  braddalton 1 year ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #58523

    htown
    Participant
    Post count: 23

    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,
    Houston

    • This topic was modified 1 year ago by  htown.
    • This topic was modified 1 year ago by  htown.
    #58525

    htown
    Participant
    Post count: 23

    I 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,
    Houston

    #58536

    Tom
    Participant
    Post count: 838

    Hi 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:

    New widget area for Executive home

    Have fun with your new widget area.

    Tom


    Choose your next site design from over 300 Genesis themes.
    Updates via GenesisThemes.ca | Twitter | Google+ | Tumblr

    • This reply was modified 1 year ago by  Tom.
    • This reply was modified 1 year ago by  Tom.
    #58574

    braddalton
    Participant
    Post count: 9308

    I’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:
    [css]
    .welcome-text {
    font-size: 20px;
    }
    [/css]


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #58583

    htown
    Participant
    Post count: 23

    Thank you Tom and Brad. That did the trick. Many thanks,

    Houston

    #58623

    braddalton
    Participant
    Post count: 9308

    No worries Houston.


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.