Placing a footer banner above footer widgets, how is this?

Community Forums Forums Design Tips and Tricks Placing a footer banner above footer widgets, how is this?

This topic is: not resolved

Tagged: ,

This topic contains 5 replies, has 2 voices, and was last updated by  braddalton 9 months, 3 weeks ago.

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

    Rusty
    Participant
    Post count: 8

    Hi Folks,

    I want to place a full width “footer banner” after the .site-inner, and before .site-footer ..

    I will use this area to create a widget area that will contain a horizontal optin form.

    My first attempt was to use ‘genesis_after_content_sidebar_wrap’, but that sent the output just under the right sidebar, still within .site-inner.

    Finally, I came up with the following snippet. It what I want it, however I don’t know if this is a “best practice”.

    Would some kind, smart person let me know if there is ‘better’ way to do this within the Genesis framework.

    Here is my snippet of code: (link to github gist here: https://gist.github.com/rustyeddy/6856424).

    /*
     * Use this footer widget to place another nav bar area
     */
    remove_action( 'genesis_before_footer', 'genesis_footer_widget_areas' );
    add_action( 'genesis_before_footer', 'lpo_do_footer_banner' );
    function lpo_do_footer_banner()
    {
        echo "<div class='lpo-footer-banner'>";
        echo "<div class='wrap'>";
        echo '<h1>This is my banner</h1>';
        echo "</div><!-- wrap -->";
        echo "</div><!-- lpo-footer-banner-wrap -->";
        genesis_footer_widget_areas();
    }
    

    Rusty Eddy

    • This topic was modified 9 months, 3 weeks ago by  Rusty. Reason: Whoops, thought I could include a github gist
    • This topic was modified 9 months, 3 weeks ago by  Rusty. Reason: < code>< /code> looks crappy
    • This topic was modified 9 months, 3 weeks ago by  Rusty. Reason: Whoops, thought I could include a github gist
    • This topic was modified 9 months, 3 weeks ago by  Rusty. Reason: < code>< /code> looks crappy
    #65617

    braddalton
    Participant
    Post count: 8876

    Here’s the correct code for adding a widget area before the footer in Genesis

    You can add any remove actions as well if you need to.

    You can also reposition the footer widgets or footer if needed http://dreamwhisperdesigns.com/genesis-tutorials/relocate-genesis-footer-widgets/


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #65844

    Rusty
    Participant
    Post count: 8

    Thanks for the response Brad!

    My main objective wasn’t so much to add the sidebar widget (I’ve done that plenty of times). It was to figure out how to get my new widget area above the footer widget area. So I tried to keep the code in the original post simple without the distraction of the sidebar widget code.

    If I use the code above it will place my “footer banner” in the incorrect order, under the footer widgets, before the footer.

    So, the only way I have been able to figure out how to get the banner above the widget area is to remove the “genesis_footer_widget_areas()’, create my own hook, and then call the “genesis_footer_widget_areas()” after printing the banner in the new hook.

    It works, so I guess it’ll be fine.

    Any way, here is the final code:

    /*
     * -------------------------------------------------------------------------
     * Create the widget area to span the width of the site above the
     * footer.
     */
    $lpo_footer_banner = array(
        'id'                => 'footer-banner',
        'name'              => __( 'Footer Banner', 'Lake Park' ),
        'description'       => __( 'Footer Banner above widgets', 'Lake Park' ));
     
    genesis_register_sidebar( $lpo_footer_banner );
     
    /*
     * Remove the existing genesis before footer hook because we are going
     * to replace it with our own.  Otherwise we'll end up with our banner
     * below the footer widet area.
     *
     * We'll then call the footer widget hook after we summons our footer
     * banner.
     */
    remove_action( 'genesis_before_footer', 'genesis_footer_widget_areas' );
    add_action( 'genesis_before_footer', 'lpo_do_footer_banner' );
     
    /*
     * Just do it.
     */
    function lpo_do_footer_banner()
    {
        /*
         * Draw the footer banner if we have placed any widgets.
         */
        if ( is_active_sidebar( 'footer-banner' ) ) {
     
            $do_widget = array (
                'before'            => "<div class='lpo-footer-banner'><div class='wrap'>",
                'after'             => "</div><!-- wrap --></div><!-- lpo-footer-banner -->",
                );
            genesis_widget_area( 'footer-banner', $do_widget );
        }
     
        /*
         * Now draw the footer widgets
         */
        genesis_footer_widget_areas();
    }
    

    The github link if anybody is interested: https://gist.github.com/rustyeddy/6856424


    Rusty Eddy

    #65904

    braddalton
    Participant
    Post count: 8876

    Not if you add a 3rd parameter for positioning priority below 10.

    Just tested the code and it displays the content before the footer.


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #66088

    Rusty
    Participant
    Post count: 8

    Thank you Brad. That is a much better (and more elegant) solution thanI came up with.

    I do now remember wondering if there was a way to prioritize the order in which elements are displayed…


    Rusty Eddy

    #66097

    braddalton
    Participant
    Post count: 8876

    No worries. Pretty simple solution which is used a lot with the new loop hooks as well.


    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.