• 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

Trouble registering sidebar

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 › General Discussion › Trouble registering sidebar

This topic is: not resolved

Tagged: Sidebar

  • This topic has 8 replies, 3 voices, and was last updated 10 years, 9 months ago by yogidev.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • March 12, 2015 at 7:05 am #144154
    yogidev
    Member

    Hi I am trying to register a sidebar and getting this error message:

    Fatal error: Call to undefined function genesis_register_sidebar()

    I've tried code from 3 different places and it happens with all of them.

    Here is one example of code I tried:

    genesis_register_sidebar( array(
    
    'id' => 'custom-sidebar',//name this whatever makes sense
    
    'name' => 'Custom Sidebar',
    
    'description' => 'This is a custom sidebar that were adding to Genesis',
    
    ) );
    
    add_action( 'get_header', 'child_sidebar_swap' );
    
    function child_sidebar_swap() {
    
    if( is_single() ) {
    
    remove_action( 'genesis_after_content', 'genesis_get_sidebar' );
    
    add_action( 'genesis_after_content', 'child_get_single_sidebar' );
    
    }
    
    }
    
    function child_get_single_sidebar() {
    
    get_sidebar( 'custom-sidebar' );
    
    }

    What I actually want to do is have a sidebar appear on my blog page and individual posts.

    I also tried 3 different plugins and none of them worked either.

    I am expecting to be able to add a few lines of code in my child theme's functions.php that shows primary sidebar only on that 1 page and all posts.

    March 12, 2015 at 7:27 am #144156
    DTHkelly
    Member

    The code from this tutorial works.

    http://www.carriedils.com/add-widget-area-below-nav/

    March 12, 2015 at 7:29 am #144157
    DTHkelly
    Member

    More reference:
    http://carlomanf.id.au/run-unique-sidebars/

    March 12, 2015 at 8:11 am #144161
    yogidev
    Member

    Thanks Kelly.

    I pasted:

    /** Register widget areas */
    genesis_register_sidebar( array(
    'id'	=> 'cta-1',
    'name'	=> __( 'Call to Action #1', 'mp' ),
    'description'	=> __( 'This is the call to action section.', 'mp' ),
    ) );
    genesis_register_sidebar( array(
    'id'	=> 'cta-2',
    'name'	=> __( 'Call to Action #2', 'mp' ),
    'description'	=> __( 'This is the call to action section.', 'mp' ),
    ) );
    genesis_register_sidebar( array(
    'id'	=> 'cta-3',
    'name'	=> __( 'Call to Action #3', 'mp' ),
    'description'	=> __( 'This is the call to action section.', 'mp' ),
    ) );
    genesis_register_sidebar( array(
    'id'	=> 'cta-4',
    'name'	=> __( 'Call to Action #4', 'mp' ),
    'description'	=> __( 'This is the call to action section.', 'mp' ),
    ) ); 

    followed by:

    /**
    * Add CTA widget support for site. If widget not active, don't display
    *
    */
    function mp_cta_genesis() {
    // Don't display the CTA on the home page, since it's built into the MP theme
    if ( is_home() ) {
    return;
    }
    // If it's the About page, display CTA #1
    elseif ( is_page( 'about' ) ) {
    genesis_widget_area( 'cta-1', array(
    'before' => '<div id="cta"><div class="wrap">',
    'after' => '</div></div>',
    ) );
    }
    // If it's a page with ID 101 or 102 or any page within my Portfolio CPT
    // Display CTA #2
    elseif ( is_page( array(101,102) ) || ('portfolio' == get_post_type() ) ) {
    genesis_widget_area( 'cta-2', array(
    'before' => '<div id="cta"><div class="wrap">',
    'after' => '</div></div>',
    ) );
    }
    // If it's the Contact page, display CTA #3
    elseif ( is_page('contact') ) {
    genesis_widget_area( 'cta-3', array(
    'before' => '<div id="cta"><div class="wrap">',
    'after' => '</div></div>',
    ) );
    }
    // If all else fails and none of the above conditions are met, display CTA #4
    else {
    genesis_widget_area( 'cta-4', array(
    'before' => '<div id="cta"><div id="enews" class="wrap">',
    'after' => '</div></div>',
    ) );
    }
    } 

    in functions.php

    I get Fatal error: Call to undefined function genesis_register_sidebar()

    This code:
    http://carlomanf.id.au/run-unique-sidebars/

    didnt generate any errors but it didnt output a sidebar either (after I added some widgets to the new items).

    The page source didnt show any sidebar references anywhere either.

    What am I missing?

    March 12, 2015 at 10:03 am #144196
    Genesis Developer
    Member

    Are you included this code at top of your functions.php file?

    
    // Start the engine
    require_once( get_template_directory() . '/lib/init.php' );

    Also you installed the genesis framework? ( It is stupid question but I am asking)


    Download Genesis Featured Posts Combo Widget | Simple Grid Layouts Plugin for Posts, CPTs and terms
    You can request new tips/help.

    March 12, 2015 at 10:06 am #144197
    yogidev
    Member

    Definitely Genesis yes,

    I'm using this:

    // Start the engine the other way
    
    add_action( 'genesis_setup','genesischild_theme_setup', 15 );
    function genesischild_theme_setup() {
    
    //Add support for HTML5 markup
    add_theme_support( 'html5' );
    //Add viewport metatag
    add_theme_support( 'genesis-responsive-viewport' );
    //Add 3 footer widgets
    add_theme_support( 'genesis-footer-widgets', 4 );
    //Add support for custom background
    add_theme_support( 'custom-background' );
    }
    March 12, 2015 at 10:27 am #144203
    Genesis Developer
    Member

    That's different things. you need to add this line at top

    require_once( get_template_directory() . '/lib/init.php' );


    Download Genesis Featured Posts Combo Widget | Simple Grid Layouts Plugin for Posts, CPTs and terms
    You can request new tips/help.

    March 13, 2015 at 12:32 pm #144312
    yogidev
    Member

    Ok so I added that and now the page loads but without my custom functions.

    For example.

    // Remove page titles
    //* Remove page title for a specific page (requires HTML5 theme support)
    //* Change '28' to your page id
    add_action( 'get_header', 'child_remove_page_titles' );
    function child_remove_page_titles() {
    if ( is_page( ) ) {
    remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
    }
    } 

    I am now getting page title and my defined h1s output on the page.
    Lots of other custom stuff in functions.php is not working.

    The sidebars still dont appear either!

    May 1, 2015 at 3:46 am #149700
    yogidev
    Member

    I had to put this on hold for a while working on other projects.

    Could you explain why the functions dont work after adding lib/init.php at the top?

  • Author
    Posts
Viewing 9 posts - 1 through 9 (of 9 total)
  • The forum ‘General Discussion’ 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

© 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