i'm creating a theme and i had a problem with functions.php file i used this code at firs
<?php
if(function_exists('register_sidebar'))
register_sidebar (array(
'name' =< 'follow us ',
'before_widget' => '<div class="widget">',
'after_widget' => '</div><!--End widget-cont--></div><!--End widget-->',
'before_title' => '<h2>',
'after_title' => '</h2><div class="widget-cont">',
));
{
register_sidebar();
}
?>
and when i enter my website it get blank page and i get this
Parse error: syntax error, unexpected '=', expecting ')' in /home/u300164519/public_html/wp-content/themes/Abs Workout/functions.php on line 5
then i fixed the problem in line 5 and change it to this code
<?php
if(function_exists('register_sidebar'))
register_sidebar (array(
'name' )< 'follow us ',
'before_widget' )> '<div class="widget">'
'after_widget' => '</div><!--End widget-cont--></div><!--End widget-->',
'before_title' => '<h2>',
'after_title' => '</h2><div class="widget-cont">',
)); {
register_sidebar();
}
?>
and again i get this!!!!
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/u300164519/public_html/wp-content/themes/Abs Workout/functions.php on line 7
what dose that mean :(! please helpp meeee! i'm tired of this :(
You have a syntax error.
Try replacing 'name' )< 'follow us '
With 'name' => 'follow us '
and
'before_widget' )> '<div class="widget">'
with 'before_widget' => '<div class="widget">'
.
You need to have the array formatted this way:
array(
key1 => value1,
key2 => value2,
keyN => valueN
);
Your code is invalid Its should be like
function my_side() {
register_sidebar( array(
'name' => 'box',
'id' => 'box',
'before_widget' => '<div id="%1$s" class="sidebar %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
) );
}
add_action( 'widgets_init', 'my_side' );