[resolved] widgetizing areas (3 posts)

  1. bluedrag
    Posted 4 years ago #

    Hello WordPress,

    I'm trying to add a widget area to my theme.. It doesn't seem to be working though.. I've done this before so I'm sure it's just something small and stupid thats stopping it from working this time.. Maybe someone here can help me.

    Here is the code in my html file

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

    Here is the code in my functions.php

    if ( function_exists('register_sidebar') )
    'name' => 'searchbar',
    'before_widget' => '',
    'after_widget' => '',
    'before_title' => '',
    'after_title' => '',
  2. Rev. Voodoo
    Posted 4 years ago #

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

    You are excluding with the !. That says if there is no dynamic sidebar, so WP would then be looking for code to display if the sidebar doesn't exist.

    THe markup I use in my html looks like:

    <?php if ( is_active_sidebar( 'searchbar' ) ) : ?>
    	<div class="post post-widget-area hentry">
    		<ul class="xoxo">
    			<?php dynamic_sidebar( 'searchbar' ); ?>
    	</div><!-- #first .widget-area -->
    <?php endif; ?>

    for a little writeup

  3. bluedrag
    Posted 4 years ago #

    Hey, thanks for your help, I wrote it out a little bit differently, but you were right about what I was doing wrong thank you. This is what I used (in the html file)

    <?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('searchbar')) : else : ?>
    <?php endif; ?>

Topic Closed

This topic has been closed to new replies.

About this Topic