• 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

Multiple "add actions" to support multiple widget areas

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 › Multiple "add actions" to support multiple widget areas

This topic is: resolved

Tagged: add_action, areas, function, multiple, support, widget

  • This topic has 2 replies, 2 voices, and was last updated 9 years, 6 months ago by ClintN.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • November 21, 2015 at 12:04 am #171696
    ClintN
    Participant

    Can you use the function add_genesis_widget_area() more than once?
    I am trying to do so but get a php error in the browser:

    Fatal error: Cannot redeclare add_genesis_widget_area() (previously declared

    Theme support for my first widget area goes well with

    //* Add support for before header widget
    add_action( 'genesis_before_header', 'add_genesis_widget_area' );
    function add_genesis_widget_area() {
                    genesis_widget_area( 'genesis_before_header', array(
    		'before' => '<div class="genesis_before_header widget-area">',
    		'after'  => '</div>',
        ) );
    
    }

    But then adding the below function causes the fatal error

    //* Add support for before footer
    add_action( 'genesis_before_footer', 'add_genesis_widget_area' );
    function add_genesis_widget_area() {
                    genesis_widget_area( 'genesis_before_footer', array(
    		'before' => '<div class="genesis_before_footer widget-area">',
    		'after'  => '</div>',
        ) );
    }

    Any ideas on adjusting the second add action?

    November 21, 2015 at 11:42 am #171709
    Christoph
    Member

    Hi,

    technically, it´s not the add__action causing the problem but the function name.
    You cannot have two functions by the same name.

    Simple rename function and the call to the function in the add_action. E.g. add_genesis_widget_area_footer


    https://www.christophherr.com | Genesis Customizations | Buy me a coffee

    November 21, 2015 at 6:22 pm #171732
    ClintN
    Participant

    Sweet,

    I was 50% with remaining the function.

    Thanks for getting me over the line

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 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

© 2025 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