• 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

Attempting to widgetize my theme using functions but site crashing

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 › Attempting to widgetize my theme using functions but site crashing

This topic is: resolved

Tagged: #Widgets #Genesis #Functions #Fataerror

  • This topic has 2 replies, 2 voices, and was last updated 3 years, 6 months ago by ilkweb.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • July 17, 2019 at 7:08 am #492401
    ilkweb
    Member

    So, using a basic Genesis function to register a new widget is taking down my site. An error is produced.

    This has never happened before as I've registered countless widgets in other themes.

    Here's what my functions.php file looks like.

    <?php
    /**
     * Business Pro Theme
     *
     * @package   Governance Solutions
     * @link      #
     * @author    Governance Solutions
     * @copyright Copyright © 2019
     * @license   GPL-3.0-or-later
     */
     
     
     
    
    // If this file is called directly, abort..
    if ( ! defined( 'WPINC' ) ) {
    	die;
    }
    
    genesis_register_sidebar( array(
    'id' => 'new-widget',
    'name' => __( 'Custom Widget', 'genesis' ),
    'description' => __( 'Custom Widget Area', 'childtheme' ),
    ) );
    
    //* Defines Clickable Logo and adds Blog Info to title
    function special_site_logo() {?><a id="sitelogo" href="<?php bloginfo( 'url' ); ?>"><img src="http://localhost/governancesolutionsmulti/wp-content/uploads/logo/web-logo.svg" alt="<?php bloginfo('name')?>" title="<?php bloginfo('name')?>" /></a><?php ;
    }
    add_action( 'genesis_site_title','special_site_logo',5,1);
    
    // Start the engine (do not remove).
    include_once get_template_directory() . '/lib/init.php';
    
    // Load setup functions.
    include_once __DIR__ . '/includes/setup.php';
    
    // Load helper functions.
    include_once __DIR__ . '/includes/helpers.php';
    
    // Load scripts and styles.
    include_once __DIR__ . '/includes/enqueue.php';
    
    // Load general functionality.
    include_once __DIR__ . '/includes/general.php';
    
    // Load hero section.
    include_once __DIR__ . '/includes/hero.php';
    
    // Load widget areas.
    include_once __DIR__ . '/includes/widgets.php';
    
    // Load Customizer settings.
    include_once __DIR__ . '/includes/customize.php';
    
    // Load default settings.
    include_once __DIR__ . '/includes/defaults.php';
    
    // Load recommended plugins.
    include_once __DIR__ . '/includes/plugins.php';
    

    The error:

    Fatal error: Call to undefined function genesis_register_sidebar() in C:\wamp64-3.0.6\www\governancesolutionsmulti\wp-content\themes\governance-solutions\functions.php on line 23

    A screenshot:

    https://ibb.co/Y3zjwQS

    July 17, 2019 at 11:56 am #492402
    Victor Font
    Moderator

    You're probably calling genesis_register_sidebar() before it's been initialized. Try registering the sidebar after all on the include once steps.


    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

    July 18, 2019 at 2:51 am #492415
    ilkweb
    Member

    Thanks, Victor. That was indeed the solution.

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Attempting to widgetize my theme using functions but site crashing’ 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

© 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