ThemeShaper Forums » Thematic

[closed]

After changing Functions.php, all I get is a white screen.

(7 posts)
  • Started 12 years ago by rysch
  • Latest reply from Thompson
  • This topic is not resolved
  1. Hi, I'm trying to put in a new widget area right between the header and the three asides in the powerblog theme. I want it to be parallel to a div I made for a CSS gallery.

    I'm using this code:
    <?php
    // This will create your feature widget area
    function my_widgets_init() {
    register_sidebar(array(
    'name' => 'Feature Aside',
    'id' => 'feature-aside',
    'before_widget' => '<li id="%1$s" class="widgetcontainer %2$s">',
    'after_widget' => "",
    'before_title' => "<h3 class=\"widgettitle\">",
    'after_title' => "</h3>\n",
    ));

    }
    add_action( 'init', 'my_widgets_init' );

    // adding the widget area to your child theme
    function my_header_widgets() {
    if ( function_exists('dynamic_sidebar') && is_sidebar_active('feature-aside') ) {
    echo '<div id="feature-aside" class="aside">'. "\n" . '<ul class="xoxo">' . "\n";
    dynamic_sidebar('feature-aside');
    echo '' . "\n" . '</div><!-- #feature-aside .aside -->'. "\n";
    }
    }
    add_action('thematic_belowheader', 'my_header_widgets', 8);

    But whenevver I click "save" and then refrehs my browser all I get is a white screen. When I take this code out, and refresh all is well. What is strange is that I just put in a header widget the other day with this exact same code and now it doesn't work.

    Is the syntax bad or something? What gives?

    Posted 12 years ago #
  2. Here is the full markup for functions.php:

    <?php
    // Load Child Theme scripts
    // http://www.cssnewbie.com/example/equal-heights/
    function childtheme_scripts() { ?>
        <script type="text/javascript">
        jQuery.noConflict();
        function equalHeight(group) {
            tallest = 0;
            group.each(function() {
                thisHeight = jQuery(this).height();
                if(thisHeight > tallest) {
                    tallest = thisHeight;
                }
            });
            group.height(tallest);
        }
        jQuery(document).ready(function() {
            equalHeight(jQuery(".main-aside"));
        });
        </script>
    <?php }
    add_action('wp_head','childtheme_scripts');
    // Adds a home link to your menu
    // http://codex.wordpress.org/Template_Tags/wp_page_menu
    function childtheme_menu_args($args) {
        $args = array(
            'show_home' => 'Home',
            'sort_column' => 'menu_order',
            'menu_class' => 'menu',
            'echo' => true
        );
        return $args;
    }
    add_filter('wp_page_menu_args','childtheme_menu_args');
    // Register Top Menus
    function register_my_menus() {
    	register_nav_menus(
    		array(
    			'top-menu' => __( 'Top Menu' ),
    		)
    	);
    }
    add_action( 'init', 'register_my_menus' );
    // Add Secondary Menu Above Header
    function top_menu() {
       if ( has_nav_menu( 'top-menu' ) ) {
    	wp_nav_menu( array( 'theme_location' => 'top-menu',
    				'container_id'=>'top-menu',
    				'container_class' => 'menu clearfix ',
                    'menu_class' => 'sf-top-menu sf-js-enabled', // we assign the sf-menu class to the menu ul so that superfish works on this menu too
                    ) );
        }
    }
    add_action('thematic_aboveheader','top_menu', 0);
    // Create a custom access div with the menu and search box
    function search_access() { ?>
                <div id="access-search">
                    <form id="searchform" method="get" action="<?php bloginfo('home') ?>">
                        <div>
                            <input id="s" name="s" type="text" value="To search, type and hit enter" size="30" tabindex="1" />
                        </div>
                    </form>
                </div>
    
    <?php }
    add_action('thematic_aboveheader','search_access',9);
    // Add a drop down category menu
    function childtheme_category_menu() { if(!is_page()) { ?>
        <div id="category-access">
            <div id="category-menu" class="menu">
                <div class="menu-title"><?php _e('Categories:', 'thematic'); ?></div>
                <ul id="category-nav" class="sf-menu">
                    <?php wp_list_categories('title_li='); ?>
    
            </div>
        </div>
    <?php } }
    add_action('thematic_belowheader','childtheme_category_menu', 5);
    // Add a widgetized aside just below the header
    function childtheme_leaderasides() { ?>
    <?php if( is_page(4)) { ?>
    	<div id="dfcg-wrapper"> <?php dynamic_content_gallery(); ?> </div>
        <?php if ( is_sidebar_active('1st-leader-aside') || is_sidebar_active('2nd-leader-aside') || is_sidebar_active('3rd-leader-aside') ) { // one of the leader asides has a widget ?>
        <div id="leader">
            <div id="leader-container">
                <?php if ( function_exists('dynamic_sidebar') && is_sidebar_active('1st-leader-aside') ) { // there are active widgets for this aside
                    echo '<div id="first-leader" class="aside sub-aside">'. "\n" . '<ul class="xoxo">' . "\n";
                    dynamic_sidebar('1st-leader-aside');
                    echo '' . "\n" . '</div><!-- #first-leader .aside -->'. "\n";
                } ?>                
    
                <?php if ( function_exists('dynamic_sidebar') && is_sidebar_active('2nd-leader-aside') ) { // there are active widgets for this aside
                    echo '<div id="second-leader" class="aside sub-aside">'. "\n" . '<ul class="xoxo">' . "\n";
                    dynamic_sidebar('2nd-leader-aside');
                    echo '' . "\n" . '</div><!-- #second-leader .aside -->'. "\n";
                } ?>       
    
                <?php if ( function_exists('dynamic_sidebar') && is_sidebar_active('3rd-leader-aside') ) { // there are active widgets for this aside
                    echo '<div id="third-leader" class="aside sub-aside">'. "\n" . '<ul class="xoxo">' . "\n";
                    dynamic_sidebar('3rd-leader-aside');
                    echo '' . "\n" . '</div><!-- #third-leader .aside -->'. "\n";
                } ?>        
    
            </div><!-- #leader-container -->
        </div><!-- #leader -->
        <?php } ?>
    <?php } }
    add_action('thematic_belowheader','childtheme_leaderasides',6);
    // Add a widgetized aside above the main asides with the start of a wrapper: #sidebar
    function childtheme_sidebarstart() { ?>
    <div id="sidebar">
      <div id="crown" class="aside crown-aside">
      	<ul class="xoxo">
      <?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('crown-aside') ) : // begin sidebar crown widgets ?>
    
          <li id="thematic-power-blog-subscribe" class="widgetcontainer widget_thematic_power_blog_subscribe">
          	<h3 class="widget-title"><?php _e('Subscribe', 'thematic'); ?></h3>
    
    <ul>
    <li><a>" title="<?php echo wp_specialchars(get_bloginfo('name'), 1) ?> <?php _e('Site RSS feed', 'thematic'); ?>" rel="alternate nofollow" type="application/rss+xml"><?php _e('Site RSS Feed', 'thematic') ?></a></li>
    </ul>
      <?php endif; // end sidebar crown widgets  ?>
    
      	</div><!-- #crown .aside -->
    <?php }
    add_action('thematic_abovemainasides','childtheme_sidebarstart');
    
    // Close div#sidebar
    function childtheme_sidebarend() { ?>
    </div><!-- #sidebar -->
    <?php }
    add_action('thematic_belowmainasides','childtheme_sidebarend');
    
    // Add breadcrumbs above the footer if Yoast Breadcrumbs are installed
    // http://yoast.com/wordpress/breadcrumbs/
    function childtheme_breadcrumbs() {
        if ( function_exists('yoast_breadcrumb') ) { ?>
            <div id="breadcrumb-nav">
                <div id="breadcrumb-nav-container">      
    
                    	<?php yoast_breadcrumb('<p id="breadcrumbs">','</p>'); ?>
    
                </div><!-- #breadcrumb-nav-container -->
            </div><!-- #breadcrumb-nav-container -->
        <?php }
    }
    add_action('thematic_abovefooter','childtheme_breadcrumbs',5);
    
    // Register new widgetized areaa and the new widgets
    function childtheme_widgets_init() {
    
        // Register new widgetized areaa
        register_sidebar(array(
            'name' => 'Crown Aside',
            'id' => 'crown-aside',
            'before_widget' => '<li id="%1$s" class="widgetcontainer %2$s">',
            'after_widget' => "",
            'before_title' => "<h3 class=\"widgettitle\">",
            'after_title' => "</h3>\n",
        ));  
    
        register_sidebar(array(
           	'name' => '1st leader Aside',
           	'id' => '1st-leader-aside',
           	'before_widget' => '<li id="%1$s" class="widgetcontainer %2$s">',
           	'after_widget' => "",
    		'before_title' => "<h3 class=\"widgettitle\">",
    		'after_title' => "</h3>\n",
        ));  
    
        register_sidebar(array(
           	'name' => '2nd leader Aside',
           	'id' => '2nd-leader-aside',
           	'before_widget' => '<li id="%1$s" class="widgetcontainer %2$s">',
           	'after_widget' => "",
    		'before_title' => "<h3 class=\"widgettitle\">",
    		'after_title' => "</h3>\n",
        ));  
    
        register_sidebar(array(
           	'name' => '3rd leader Aside',
           	'id' => '3rd-leader-aside',
           	'before_widget' => '<li id="%1$s" class="widgetcontainer %2$s">',
           	'after_widget' => "",
    		'before_title' => "<h3 class=\"widgettitle\">",
    		'after_title' => "</h3>\n",
        ));  
    
        // Register the new widgets
        register_sidebar_widget('Thematic Power Blog Subscribe', 'thematic_power_blog_subscribe');
    }
    add_action( 'init', 'childtheme_widgets_init' );  
    
    // This will create your widget area
    function my_widgets_init() {
        register_sidebar(array(
           	'name' => 'Header Aside',
           	'id' => 'header-aside',
           	'before_widget' => '<li id="%1$s" class="widgetcontainer %2$s">',
           	'after_widget' => "",
    		'before_title' => "<h3 class=\"widgettitle\">",
    		'after_title' => "</h3>\n",
        ));
    }
    add_action( 'init', 'my_widgets_init' );
    
    // adding the widget area to your child theme
    function my_header_widgets() {
    if ( function_exists('dynamic_sidebar') && is_sidebar_active('header-aside') ) {
        echo '<div id="header-aside" class="aside">'. "\n" . '<ul class="xoxo">' . "\n";
        dynamic_sidebar('header-aside');
        echo '' . "\n" . '</div><!-- #header-aside .aside -->'. "\n";
    }
    }
    add_action('thematic_header', 'my_header_widgets', 8);
    ?>
    Posted 12 years ago #
  3. These are the errors that got spit out:

    otice: register_sidebar_widget is deprecated since version 2.8! Use wp_register_sidebar_widget() instead. in /Applications/MAMP/htdocs/wordpress/wp-includes/functions.php on line 3237
    
    Notice: register_widget_control is deprecated since version 2.8! Use wp_register_widget_control() instead. in /Applications/MAMP/htdocs/wordpress/wp-includes/functions.php on line 3237
    
    Notice: load_plugin_textdomain was called with an argument that is deprecated since version 2.7 with no alternative available. in /Applications/MAMP/htdocs/wordpress/wp-includes/functions.php on line 3323
    
    Notice: register_sidebar_widget is deprecated since version 2.8! Use wp_register_sidebar_widget() instead. in /Applications/MAMP/htdocs/wordpress/wp-includes/functions.php on line 3237
    
    Notice: Undefined index: viewOption in /Applications/MAMP/htdocs/wordpress/wp-content/plugins/the-events-calendar/template-tags.php on line 13
    
    Notice: Undefined variable: _SESSION in /Applications/MAMP/htdocs/wordpress/wp-content/plugins/pixopoint-menu/core.php on line 71
    
    Notice: Undefined variable: _SESSION in /Applications/MAMP/htdocs/wordpress/wp-content/plugins/pixopoint-menu/core.php on line 74
    
    Notice: Undefined index: viewOption in /Applications/MAMP/htdocs/wordpress/wp-content/plugins/the-events-calendar/template-tags.php on line 13
    
    Notice: Undefined index: viewOption in /Applications/MAMP/htdocs/wordpress/wp-content/plugins/the-events-calendar/template-tags.php on line 13

    I don't understand why these are the errors I'm getting since I have only messed with Functions.php

    Posted 12 years ago #
  4. And then this is what I get when I try to log in:

    Notice: register_sidebar_widget is deprecated since version 2.8! Use wp_register_sidebar_widget() instead. in /Applications/MAMP/htdocs/wordpress/wp-includes/functions.php on line 3237
    
    Notice: register_widget_control is deprecated since version 2.8! Use wp_register_widget_control() instead. in /Applications/MAMP/htdocs/wordpress/wp-includes/functions.php on line 3237
    
    Notice: load_plugin_textdomain was called with an argument that is deprecated since version 2.7 with no alternative available. in /Applications/MAMP/htdocs/wordpress/wp-includes/functions.php on line 3323
    
    Notice: register_sidebar_widget is deprecated since version 2.8! Use wp_register_sidebar_widget() instead. in /Applications/MAMP/htdocs/wordpress/wp-includes/functions.php on line 3237
    
    Warning: Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/wordpress/wp-includes/functions.php:3237) in /Applications/MAMP/htdocs/wordpress/wp-includes/pluggable.php on line 890
    Posted 12 years ago #
  5. Looks like this is a much bigger problem than functions.php.

    I downloaded a fresh copy of Power Blog and copied the functions.php into the theme folder I'm using and I still get tons of errors and a white screen when I try to log in.

    Looks like I'm going to have to do a fresh install of everything. :-(

    Posted 12 years ago #
  6. notices and warnings are not fatal errors. you must have turned on debug mode or something as those usually do not show up otherwise. check your wp-config.php file and make sure wp_debug is set to false.

    however, it is helpful to leave it set to true if you are experiencing the 'white screen of death' b/c it will point you to the part of the code that you have bollocksed up. if you still can't figure it out then i recommend clearing out your functions.php and then pasting the pieces back in 1 at a time to isolate the problem.

    Posted 12 years ago #
  7. Thompson
    Member

    A white screen of death can also be caused by extraneous space either before the opening PHP '<?php' and after the close PHP '?>'. The latter is more common than the former. Just one more thing to try.

    Posted 12 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.