WordPress.org

Support

Support » Themes and Templates » Widgetize Sidebar

Widgetize Sidebar

  • StephanieS

    @stephanies

    Hi,

    I am brand new to wordpress and I have a theme that I really like but its not Widgetized. I tried following the instructions to add the few lines of code to the theme with no success. I was able to create the functions.php file and now it at least lets me go to the “Add Widget” menu in the admin console.

    Here is the Sidebar.php code, please let me know what changes I should make to get it to work. Thanks So much!

    <div id="sidebar">
    <div id="rss">
    <a href="<?php bloginfo('rss2_url'); ?>" title="RSS FEED"><img border="0" src="<?php bloginfo('stylesheet_directory'); ?>/images/rss.gif" width="150" alt="RSS FEED"height="28"></a>
    </div>
    <div id="searchbg">
    <form method="get" id="searchform" action="<?php bloginfo('home'); ?>/"><p align="center">
    <input type="text" value="search..." name="s" id="s"
    value="search..." onblur="if (this.value == '') {this.value = 'search...';}"
    onfocus="if (this.value == 'search...') {this.value = '';}"/>
    <input type="submit" value="&raquo;" id="go"></form>
    </div>
    		<ul>
    				<li>
    					<h2>Categories</h2>
    					<ul>
    						<?php wp_list_cats('sort_column=name&hierarchical=0'); ?>
    					</ul>
    				</li>
    
    				<li>
    					<h2>Archives</h2>
    					<ul>
    						<?php wp_get_archives('type=monthly'); ?>
    					</ul>
    				</li>
    
    			</li>
    			</ul>
    				<div id="calendar">
    				<div align="center"><?php get_calendar(1); ?></div></div>
    
    			<ul>
    
    				<li>
    				<li>
    					<h2>Blogroll</h2>
    					<ul>
    						<?php get_links(-1, '<li>', '</li>', '', FALSE, 'name', FALSE, FALSE, -1, FALSE); ?>
    					</ul>
    				</li>
    
    				<li>
    					<h2>Meta</h2>
    					<ul>
    						<?php wp_register(); ?>
    						<li><?php wp_loginout(); ?></li>
    						<?php wp_meta(); ?>
    					</ul>
    				</li>
    			</ul>
    		</div>
    		<!-- end #sidebar -->
Viewing 6 replies - 1 through 6 (of 6 total)
  • StephanieS

    @stephanies

    any ideas?

    CognitiveCombine

    @cognitivecombine

    As far as I can tell you have not added the php code tag to call the widgets in your sidebar:

    <?php if ( !function_exists('dynamic_sidebar')
    || !dynamic_sidebar() ) : ?>

    StephanieS

    @stephanies

    Exactly I am not sure where to put

    <?php if ( !function_exists(‘dynamic_sidebar’)
    || !dynamic_sidebar() ) : ?>

    Within the sidebar.php code. Do you know exactly where I should place it?

    CognitiveCombine

    @cognitivecombine

    You can place it wherever you like, you could create a new div or even just add a table and place this code inside it. It doesn’t have to anywhere specific.

    StephanieS

    @stephanies

    Ok I get this error when I put that code in. Parse error: parse error, unexpected $ on line 56 which is <!– end #sidebar –> I put
    <?php if ( !function_exists(‘dynamic_sidebar’)
    || !dynamic_sidebar() ) : ?>

    right at the top of the sidebar.php file.

    <?php if ( !function_exists('dynamic_sidebar')
    || !dynamic_sidebar() ) : ?>
    <div id="sidebar">
    <div id="rss">
    <a href="<?php bloginfo('rss2_url'); ?>" title="RSS FEED"><img border="0" src="<?php bloginfo('stylesheet_directory'); ?>/images/rss.gif" width="150" alt="RSS FEED"height="28"></a>
    </div>
    <div id="searchbg">
    <form method="get" id="searchform" action="<?php bloginfo('home'); ?>/"><p align="center">
    <input type="text" value="search..." name="s" id="s"
    value="search..." onblur="if (this.value == '') {this.value = 'search...';}"
    onfocus="if (this.value == 'search...') {this.value = '';}"/>
    <input type="submit" value="&raquo;" id="go"></form>
    </div>
    CognitiveCombine

    @cognitivecombine

    Sorry there was a typo in the code, use this instead:

    <?php if ( !function_exists('dynamic_sidebar')
    || !dynamic_sidebar() ) ; ?>

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Widgetize Sidebar’ is closed to new replies.