WordPress.org

Ready to get started?Download WordPress

Forums

register_sidebar in functions.php causing blank page. (7 posts)

  1. leoproducer
    Member
    Posted 2 years ago #

    My issue seems to be with the register_sidebar function inside my functions.php file. If I remove register_sidebar from functions.php, my pages begin to load correctly, except now I have no widgets.

    I added register_sidebar so that I could widgetize my theme, yet it is breaking my site.

    comecrawl.com

    This is what my functions.php file looks like:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Would anyone happen to know why this is happening?

  2. Digital Raindrops
    Member
    Posted 2 years ago #

    You need to use register_sidebars(1); not register_sidebar()

    See here!

    HTH

    David

  3. leoproducer
    Member
    Posted 2 years ago #

    Thanks for the attempt. I tried both:

    <?php
    if (function_exists('register_sidebars'))
        register_sidebars();
    
    ?>

    as well as

    <?php
    if (function_exists('register_sidebars'))
        register_sidebars(1);
    
    ?>

    Any other suggestions?

  4. leoproducer
    Member
    Posted 2 years ago #

    Moderator, my apologies for not using pastebin before, therefore, here is the pastebin code if anyone would like to help me out:

    http://pastebin.com/embed_iframe.php?i=KtHyHzsa

    To clear up my issue. It can easily be replicated by going to http://www.comecrawl.com as opposed to just comecrawl.com

    If the 'www' is introduced, the site does not work. It can also be replicated by going to comecrawl.com and clicking on the links. You will get a blank page. This is also occuring from inside wp-admin. Any change I make in wp-admin takes me to a blank page and I need to do a page refresh.

    Note: This ONLY happens with the register_sidebars() code in functions.php. If it is removed, the problem seizes.

    Thanks,

    Leo

  5. leoproducer
    Member
    Posted 2 years ago #

    I reverted back to using the functions.php file from inside the twentyten theme. Unless someone has an idea why my functions.php file was wigging out, Ill keep the other function.php file.

  6. Paul
    Member
    Posted 2 years ago #

    Try...
    1. Backup/rename existing functions.php file.
    2. On your computer, create a new functions.php file
    3. Copy your existing code to the new file and re-upload via FTP

    I encounter this sometimes with functions.php or other theme template files and doing this works for me.

  7. Digital Raindrops
    Member
    Posted 2 years ago #

    Hi Leo,
    In functions.php we do not close the <?php tag it is left open, check the twenty ten functions.php

    In other files we always close the php tags <?php //Do something ?>

    try!

    <?php
    
     if (function_exists('register_sidebars')) register_sidebars(1);
    
    if (!is_admin() && !current_user_can('add_users')){
        wp_deregister_script( 'admin-bar' );
        wp_deregister_style( 'admin-bar' );
        remove_action('wp_footer','wp_admin_bar_render',1000);
    }

    HTH

    David

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.