• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Widgets only on homepage

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Widgets only on homepage

This topic is: not resolved

Tagged: home, page, slider, widget

  • This topic has 1 reply, 2 voices, and was last updated 10 years, 2 months ago by Doak Heggeness.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • April 11, 2013 at 4:26 pm #34864
    ScottReinmuth
    Member

    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>

    April 11, 2013 at 4:44 pm #34869
    Doak Heggeness
    Member

    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

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble