benny148148
Member
Posted 3 years ago #
I'm trying to make my sidebar widget enabled...how can I change the code to make widgets work? Code from my current sidebar is below...
<div id="sidebar">
<ul>
<?php get_links_list(); ?>
</ul>
<ul>
<?php wp_list_pages('sort_column=menu_order&title_li=<h2>' . __('Pages') . '</h2>' ); ?>
</ul>
</div>
Thanks!
If you have a functions.php file within your theme add this line
<?php
if ( function_exists('register_sidebar') )
register_sidebar();
?>
if you don't have it. Create the file and add the code above.
Then replace the above code with this:
<div id="sidebar">
<ul>
<?php if ( function_exists(’dynamic_sidebar’) && dynamic_sidebar() ) : else : ?>
</ul>
<ul>
<?php get_links_list(); ?>
</ul>
<ul>
<?php wp_list_pages('sort_column=menu_order&title_li=<h2>' . __('Pages') . '</h2>' ); ?>
</ul>
</div>
benny148148
Member
Posted 3 years ago #
Madsk,
Thanks for your help...however I received the following error when I did what you said :
Parse error: syntax error, unexpected $end in D:\(removed)\wp-content\themes\DarkLife_01\sidebar.php on line 11
Any ideas?
Did you copy / paste the code above? If so i can see that the ´´ around dynamic sidebar are wrong. you need to change them to the appropriate ones ''. Sorry for that.
benny148148
Member
Posted 3 years ago #
Very strange...it's still giving me the error even after I fixed the ' marks around dynamic sidebar.
I copy/pasted my code below.
functions.php
<?php
if ( function_exists('register_sidebar') )
register_sidebar();
?>
sidebar.php
<div id="sidebar">
<ul>
<?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar() ) : else : ?>
</ul>
<ul>
<?php get_links_list(); ?>
</ul>
<ul>
<?php wp_list_pages('sort_column=menu_order&title_li=<h2>' . __('Pages') . '</h2>' ); ?>
</ul>
</div>
benny148148
Member
Posted 3 years ago #