• 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

Fatal error trying to add a widget

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 › Fatal error trying to add a widget

This topic is: resolved

Tagged: Fatal Error, widget

  • This topic has 2 replies, 2 voices, and was last updated 11 years, 4 months ago by hmistler.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • January 16, 2015 at 1:25 pm #137691
    hmistler
    Member

    Hi there - I successfully added a widget to my blog page following the instructions on Studiopress & WP Sites. I then tried to add a widget to another page on my site (my about page) and each time I do, following the same steps as before, I get a fatal error:

    "Fatal error: Cannot redeclare add_genesis_widget_area() (previously declared in /home/haleymistler1212/public_html/wp-content/themes/swank/functions.php:111) in /home/haleymistler1212/public_html/wp-content/themes/swank/functions.php on line 166"

    Here is the code I used:

    //* Add studio widget
    add_action( 'genesis_after_header', 'add_genesis_widget_area' );
    function add_genesis_widget_area() {
    		if (is_page('about'))
                    genesis_widget_area( 'studio-widget', array(
    		'before' => '<div class="studio-widget widget-area">',
    		'after'  => '</div>',
        ) );
    
    }

    And:

    genesis_register_sidebar( array(
    	'id'          => 'studio-widget',
    	'name'        => __( 'Studio Widget', 'swank' ),
    	'description' => __( 'This is the studio widget', 'swank' ),
    ) );

    Both of these are in functions.php. As I said, I used this same code to add a 'blog widget' to my blog page and it worked perfectly. Any ideas as to why I can't get this widget to work? FYI, when I leave the Genesis_register_sidebar in the fuctions.php, everything is fine - it's only when I add the add_action code that things go HAYWIRE.

    Thanks in advance!!!

    http://haleymistler.com
    January 16, 2015 at 5:38 pm #137714
    Ren Ventura
    Member

    If you used the exact code before, you're declaring the add_genesis_widget_area() function multiple times. You'll need to roll both instances into one or rename the function for one of them.


    Web & Software Developer & Blogger | RenVentura.com | Follow Me on Twitter @CLE_Ren

    January 20, 2015 at 12:34 pm #138108
    hmistler
    Member

    Oh, I see! I am new to php and trying to get the hang of it; I was able to fix it. Thank so much!

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Fatal error trying to add a widget’ is closed to new replies.

CTA

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

Create a site with WP EngineShop for Themes

Footer

StudioPress

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