Custom Widget Area for Home page – Agency Theme

Community Forums Forums Design Tips and Tricks Custom Widget Area for Home page – Agency Theme

This topic is: not resolved

This topic contains 1 reply, has 2 voices, and was last updated by  braddalton 1 year, 6 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #35143

    Greg W
    Participant
    Post count: 3

    Hi Everyone

    I am trying to work out the right way to add a custom widget to my home page for the Agency theme. I want to be able to put in a regular content area that sits  in between the 3 home widgets and above the footer widgets.

    I have already registered my new widget. I tried using hooks but I need to get in between the home widgets and the footer widget areas.

    My regsiter code:
    genesis_register_sidebar( array(
    ‘id’ => ‘home-featured-content’,
    ‘name’ => __( ‘Home Featured Content’, ‘agency’ ),
    ‘description’ => __( ‘This is the home featured content section.’, ‘agency’ ),
    ) );
    I tried putting my code for the widget inside function agency_home_loop_helper() and it works but I am not sure if this is the best way to do this.

    Here is where I put my code:

    function agency_home_loop_helper() {

    if ( is_active_sidebar( ‘home-left’ ) || is_active_sidebar( ‘home-middle’ ) || is_active_sidebar( ‘home-right’ ) ) {

    echo ‘<div id=”home”>’;

    echo ‘<div class=”home-left”>’;
    dynamic_sidebar( ‘home-left’ );
    echo ‘</div><!– end .home-left –>’;

    echo ‘<div class=”home-middle”>’;
    dynamic_sidebar( ‘home-middle’ );
    echo ‘</div><!– end .home-middle –>’;

    echo ‘<div class=”home-right”>’;
    dynamic_sidebar( ‘home-right’ );
    echo ‘</div><!– end .home-right –>’;

    echo ‘</div><!– end #home –>’;

    }

    // ———————————— code for my custom widget to show here
    if ( is_active_sidebar( ‘home-featured-content’ ) ) {
    echo ‘<div id=”home-featured-content”>’;
    dynamic_sidebar( ‘home-featured-content’ );
    echo ‘</div><!– end .home-featured –>’;
    }

    }

    Should I add a new structural wrap? If I do, how would I target this in my home.php file? The examples I have tried so far only allow for ‘before’ or ‘after’ or putting it in to an existing function.

    Any help would be appreciated.

    Thanks.

    #35181

    braddalton
    Participant
    Post count: 10157

    You can add it to a custom function in your child theme.

    You’d need to add a conditional tag and use different code. http://codex.wordpress.org/Conditional_Tags
    [php]
    is_home() or is_front_page()
    [/php]
    Here’s some sample code:

    You can change the hook location. Here’s visual reference of where the hooks output your widget content http://genesistutorials.com/visual-hook-guide/

    More code for custom widgets and Genesis child theme customization https://gist.github.com/5351168


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

You must be logged in to reply to this topic.