Widgets only on homepage

Community Forums Forums Design Tips and Tricks Widgets only on homepage

This topic is: not resolved

Tagged: , , ,

This topic contains 1 reply, has 2 voices, and was last updated by  Doak Heggeness 1 year, 4 months ago.

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

    ScottReinmuth
    Participant

    I am trying to put some widgets on the homepage but something is not working. This is the code that I have.

     

    <code>

    // Custom Home Template
    register_sidebar(array(
    ‘name’ => __( ‘Slider Widget’ ),
    ‘id’ => ‘slider-widget’,
    ‘class’ => ”,
    ‘description’ => __( ‘optional widget area for a slider’ ),
    ‘before_title’ => ‘<div>’,
    ‘after_title’ => ‘</div>’,
    ‘before_widget’ => ‘<div id=”%1$s” class=”widget %2$s”>’,
    ‘after_widget’ => ‘</div>’,
    ));
    register_sidebar(array(
    ‘name’ => __( ‘Left Home Widget’ ),
    ‘id’ => ‘left-home-widget’,
    ‘class’ => ”,
    ‘description’ => __( ‘Left side widget for home page’ ),
    ‘before_title’ => ‘<div class=”home-widget-title”>’,
    ‘after_title’ => ‘</div>’,
    ‘before_widget’ => ‘<div id=”%1$s” class=”widget %2$s”>’,
    ‘after_widget’ => ‘</div>’,
    ));
    register_sidebar(array(
    ‘name’ => __( ‘Center Home Widget’ ),
    ‘id’ => ‘center-home-widget’,
    ‘class’ => ”,
    ‘description’ => __( ‘Middle widget for home page’ ),
    ‘before_title’ => ‘<div class=”home-widget-title”>’,
    ‘after_title’ => ‘</div>’,
    ‘before_widget’ => ‘<div id=”%1$s” class=”widget %2$s”>’,
    ‘after_widget’ => ‘</div>’,
    ));
    register_sidebar(array(
    ‘name’ => __( ‘Right Home Widget’ ),
    ‘id’ => ‘right-home-widget’,
    ‘class’ => ”,
    ‘description’ => __( ‘Right side widget for home page’ ),
    ‘before_title’ => ‘<div class=”home-widget-title”>’,
    ‘after_title’ => ‘</div>’,
    ‘before_widget’ => ‘<div id=”%1$s” class=”widget %2$s”>’,
    ‘after_widget’ => ‘</div>’,
    ));
    function home_template(){ ?>
    <div id=”home-widget-area” class=”clearfix”>
    <div id=”home-slider”>
    <?php dynamic_sidebar( ‘Slider Widget’ ); ?>
    </div>

    <div class=”one-third first”>
    <?php dynamic_sidebar( ‘Left Home Widget’ ); ?>
    </div>

    <div class=”one-third”>
    <?php dynamic_sidebar( ‘Center Home Widget’ ); ?>
    </div>

    <div class=”one-third”>
    <?php dynamic_sidebar( ‘Right Home Widget’ ); ?>
    </div>
    </div>
    <?php } ?>

    <?php
    if(is_front_page()){
    add_action(‘genesis_after_header’, ‘home_template’);
    }

    </code>

    #34869

    Doak Heggeness
    Participant
    Post count: 140

    I am not going to get into your code, but….

    1) Register widgets in functions.php file. Follow the examples in the file.
    2) Add widget areas to home.php or template. See home.php for example.
    3) Add new div’s to stylesheet for design.


    Doak Heggeness, WordPress Development | Website

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

You must be logged in to reply to this topic.