Trying to add widgets to single.php, getting syntax error.
-
I’m editing a theme and I came up with the bright idea to replace the comments beneath each post with two widgets.
I added the following code to my functions.php for each of them:
if (function_exists('register_sidebar')) { register_sidebar(array( 'name' => 'Extra Widgets', 'id' => 'extra-widgets', 'description' => 'The extra widgets for your website.', 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h2>', 'after_title' => '</h2>' )); }No problem.
Now, when I go into my single.php file to remove the comments code and replace it with:
<ul><?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Extra Widgets')) : endif; ?></ul>Dreamweaver is telling me I have a syntax error in my code. The line it singles out is:
<?php get_footer(); ?>I’m not sure what I’m doing wrong. I’m removing the comments code in its entirety and the only thing between the code I’m pasting in and <?php get_footer();?> is:
<div class="clear"></div> </div> <?php get_sidebar('left'); ?> </div> <div class="clear"></div> </div>Any ideas on where I’m going wrong?
Thanks!
The topic ‘Trying to add widgets to single.php, getting syntax error.’ is closed to new replies.