Community Forums › Forums › Archived Forums › Design Tips and Tricks › Can't Register Genesis Sidebar – Fatal Error
Tagged: Fatal Error, genesis, widget area
- This topic has 10 replies, 2 voices, and was last updated 10 years, 10 months ago by
anschoolfield.
-
AuthorPosts
-
May 28, 2014 at 12:53 pm #107149
anschoolfield
MemberI'm using Genesis 2.0.2 and Picture Perfect child theme from AgentEvolution.
I want to add a new widget area to the left of the screen. I've used this tutorial numerous times on other sites and it's worked every time. Now, when I put in the first snippet into my functions.php, I get this:
Fatal error: Call to undefined function genesis_register_sidebar() in /home4/myamanda/public_html/test/wp-content/themes/picture-perfect/functions.php on line 90
What do I need to do to register the function?
http://test.myamandadesignplayground.com/May 28, 2014 at 1:16 pm #107162nutsandbolts
MemberI'm not familiar with that child theme, but some do things a little differently and require a different type of function. Can you paste in the functions.php from the child?
Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
I provide development and training services for designers • Find me on Twitter and Google+May 28, 2014 at 1:19 pm #107163nutsandbolts
MemberYou may need to try it like this:
add_action( 'genesis_setup', 'nabm_banner' ); function nabm_banner() { genesis_register_sidebar( array( 'id' => 'pagewidget', 'name' => __( 'Page Widget', 'nabm' ), 'description' => __( 'This is the widget area for a specific page.', 'nabm' ), ) ); }
Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
I provide development and training services for designers • Find me on Twitter and Google+May 28, 2014 at 1:21 pm #107166anschoolfield
MemberSure,
<?php /** * Functions * * PHP version 5 * * @package PicturePerfect/Setup * @author Agent Evolution <[email protected]> * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License * @link http://themes.agentevolution.com */ if (defined('ABSPATH') === false) { die('Sorry, you are not allowed to access this file directly.'); } define('AE_CHILD_THEME_NAME', 'Picture Perfect'); define('AE_CHILD_THEME_SLUG', 'picture-perfect'); require_once 'lib/classes/class-agentevo-helpers.php'; require_once 'lib/classes/class-agentevo-customizer.php'; require_once 'lib/classes/class-agentevo-nav-walker.php'; require_once 'lib/functions/admin.php'; require_once 'lib/functions/frontend.php'; /** * Outputs the footer markup * * @return void */ function picture_perfect_footer() { ?> <div class="one-half first footer-left"> <?php echo do_shortcode(genesis_get_option('footer-left', 'agentevo-footer-settings')); ?> </div> <div class="one-half footer-right"> <?php echo do_shortcode(genesis_get_option('footer-right', 'agentevo-footer-settings')); ?> </div> <?php $disclaimer = genesis_get_option('disclaimer', 'agentevo-footer-settings'); if (false === empty($disclaimer)) { echo ' <div class="footer-disclaimer">', do_shortcode(wpautop($disclaimer)), '</div>'; } } # Include functions that should run in development only # Else serve css/style.css // if ( isset($_SERVER['SERVER_NAME']) && 'localhost' == $_SERVER['SERVER_NAME'] ) { // require_once 'lib/classes/class-agentevo-development-setup.php'; // } else { // add_filter('stylesheet_uri', 'picture_perfect_stylesheet_uri', 10, 2); // } /** * Returns the path to the style.css file * * @return string path to the style.css file */ function picture_perfect_stylesheet_uri($stylesheet_uri, $stylesheet_dir_uri) { return $stylesheet_dir_uri . '/style.css'; } if ( ! get_option('picture_perfect_theme_activation') ) { wp_remote_post( 'http://themes.agentevolution.com/child-theme-stats', array( 'body' => array( 'theme' => 'picture_perfect', 'url' => $_SERVER['SERVER_NAME'], ) ) ); add_option('picture_perfect_theme_activation', 'yes'); }
I've been adding the first snippet from your (awesome) tutorial at the very bottom. Usually I put it with the other register sidebar functions, but since there were no others I just put it at the bottom.
Thanks Andrea!
May 28, 2014 at 1:24 pm #107167nutsandbolts
MemberYeah, that's what I thought. See my previous response above for a snippet that should work with the child theme. This one uses a lot of additional files outside the main child theme directory - I did some work for a client on one with a similar setup and the one above worked.
Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
I provide development and training services for designers • Find me on Twitter and Google+May 28, 2014 at 1:32 pm #107171anschoolfield
MemberAlrighty,
It's not putting out Fatal Error anymore, so we're close! Now to get it to show up what do I need to add to home.php?
Here's home.php:
<?php /** * Home * * PHP version 5 * * @package PicturePerfect * @author Agent Evolution <[email protected]> * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License * @link http://themes.agentevolution.com */ add_action('genesis_meta', 'picture_perfect_home_genesis_meta'); /** * Add widget support for homepage. If no widgets active, display the default loop. * * @return void */ function picture_perfect_home_genesis_meta() { $sidebar_widget_areas = array( 'home-right', ); if (false === any_picture_perfect_sidebar_is_active($sidebar_widget_areas)) { add_filter('body_class', 'picture_perfect_blog_home_page_body_class'); return; } add_filter('genesis_pre_get_option_site_layout', '__genesis_return_full_width_content'); remove_action('genesis_after_content', 'genesis_footer_widget_areas', 999); # Custom body class add_filter('body_class', 'picture_perfect_custom_home_page_body_class'); # Remove the loop and add a custom loop remove_action('genesis_loop', 'genesis_do_loop'); add_action('genesis_loop', 'picture_perfect_home_loop_helper'); } /** * Adds a custom body class on the home page * * @param array $classes the current body classes * * @return array modified classes */ function picture_perfect_blog_home_page_body_class($classes) { $classes[] = 'blog-home-page'; return $classes; } /** * Adds a custom body class on the home page * * @param array $classes the current body classes * * @return array modified classes */ function picture_perfect_custom_home_page_body_class($classes) { $classes[] = 'custom-home-page'; return $classes; } /** * Display widget content for homepage sections * * @return void */ function picture_perfect_home_loop_helper() { echo '<div class="home-right">'; picture_perfect_site_title_description_markup(); if (is_active_sidebar('home-right')) { dynamic_sidebar('home-right'); } } /** * Returns true if any of the picture_perfect sidebars are active * * @param array $sidebar_widget_areas registered sidebars for use on home page * * @return bool */ function any_picture_perfect_sidebar_is_active($sidebar_widget_areas) { foreach($sidebar_widget_areas as $sidebar) { if ( is_active_sidebar($sidebar) ) { return true; } } return false; } genesis();
I only want it to show up on the home page.
Thanks!!
May 28, 2014 at 1:35 pm #107173nutsandbolts
MemberI'm guessing the theme has a home.php already? If so, my tutorial won't help you much since it depends on your template (assuming you're using a widgetized homepage and not a static page). If you can paste in the current home.php I'll try to help you get it working. Alternately, you can call it from functions.php with a conditional to display only on the homepage.
Edit: I see you beat me to it. Looking now 🙂
Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
I provide development and training services for designers • Find me on Twitter and Google+May 28, 2014 at 1:36 pm #107175nutsandbolts
MemberSo where exactly does this need to show in relation to what's on the homepage already?
Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
I provide development and training services for designers • Find me on Twitter and Google+May 28, 2014 at 1:38 pm #107176anschoolfield
MemberWell, I can style it in CSS once it shows up, but basically I want it on the left, vertically centered. I'm going to put a call to action quote and button there.
May 28, 2014 at 1:41 pm #107177nutsandbolts
MemberThis reply has been marked as private.May 28, 2014 at 1:44 pm #107178anschoolfield
MemberThis reply has been marked as private. -
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.