• ralph88

    (@ralph88)


    Hi,

    I hope somebody can help. I put this code into functions.php to create new widgets. I made a mistake by putting the semicolon after the closing bracket in line 1. However didn’t notice until wordpress crashed. I tried removing the semicolon but it didn’t bring back the site. I also tested the same piece of code on another wordpress installation and was able to crash and recover wordpress after putting in and deleting the semicolon (on a different theme).

    By running this code have I created something somewhere else that is now the problem? I have tried removing the whole theme and this did solve the problem however I need to use the theme as I’ve built it from scratch.

    Can anybody help?

    Many thanks

    Ralph

    function create_widget( $name, $id, $description ); {
    	$args = array(
    		'name'          => __( $name ),
    		'id'            => $id,
    		'description'   => $description,
    		'before_widget' => '',
    		'after_widget'  => '',
    		'before_title'  => '<h5>',
    		'after_title'   => '</h5>'
    	);
    
    	register_sidebar( $args );
    }
    
    create_widget( 'Left Footer', 'footer_left', 'Displays in the bottom left of footer' );
    create_widget('Middle Footer', 'footer_middle', 'Displays in the middle of footer');
    create_widget('Right Footer', 'footer_right', 'Displays in the bottom right of footer');

The topic ‘Widget – Function.php mistake. how to fix. Please help!’ is closed to new replies.