WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to add both custom html that advanced text widgets can't support and the standard sidebar widgets in the same sidebar. However, when I put a sidebar widget into the theme, it removes all the custom html and just displays the widgets in the sidebar. It shouldn't be a tough fix, but I am pretty big php noob who learned wordpress by trial and error. I have attached the code from my sidebar:

    <div class="sidebar-blog">

        <div class="widget-wrap">
                    <div class="widget">
        <h4>Title goes here</h4>

            <p>Content goes here<p>


        <div class="widget-wrap">
                    <div class="widget">
        <h4>Title goes here</h4>

            <p>Content goes here<p>


    </div><!--end .sidebar-blog div-->

Thanks for any help

share|improve this question
Please mark one of these answers as "best" so it will be removed from the unanswered list. – MikeSchinkel Feb 1 '11 at 3:35
up vote 4 down vote accepted

I suppose you are doing something like this:

<?php if ( ! dynamic_sidebar( 'widget-area' ) ) : ?>
    Your sidebar code goes here.
<?php endif; ?>

If yes, do this instead:

Your sidebar code goes here.
<?php dynamic_sidebar( 'widget-area' ); ?>
share|improve this answer
I think so, right after <div class="sidebar-blog">, I have: <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Sidebar') ) : ?> I am not sure why it didn't paste the first time, sorry. I'll check it out, thanks for the help! – Jeff Oct 4 '10 at 22:30

You could also use a plugin - like http://www.mlynn.org/graceful-sidebar-plugin that I just wrote and plublished. The Graceful Sidebar Plugin creates a widget that enables you to use custom fields in a post or page that display in the sidebar. You can use it to display custom html or a simple message. The custom fields it uses are graceful_title and graceful_content.

share|improve this answer

That should do it:

    <!-- START Title & static content -->
    <div id="sidebar-right-default-content" class="span-6 last">
    <h3><?php _e('Your headline for the sidebar', TEXTDOMAIN); ?></h3>
        <?php some_function(); ?>
    <hr />
    <!-- END Title & static content -->

    <!-- Sidebar right (default) - Widget Area - Adds a predefined Textwidget until nothing is defined via Admin UI > Design > Widgets -->
    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() && !is_active_sidebar( 'widgets-sidebar-right-default' ) ) :

                'title'     => 'Textwidget'
                ,'text'     => '
                        Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
                        Aenean et quam a ante sodales feugiat. Aliquam et vulputate turpis. 
                        Mauris quis sodales neque. Sed vestibulum faucibus eros nec tincidunt. 
                        Integer tortor magna, suscipit vitae ultricies vel, vehicula sit amet sapien. 
                ,'filter'   => ''
                'before_widget' => '<div class="widget-container">'
                ,'after_widget' => '</div>'
                ,'before_title' => '<h4 class="widget-title">'
                ,'after_title'  => '</h4>'

    elseif ( is_active_sidebar( 'widgets-sidebar-right-default' ) ) : 
        dynamic_sidebar( 'widgets-sidebar-right-default' );

<!-- END Sidebar right (default) -->
share|improve this answer
@Jeff: And please don't forget to mark one answer as sollution to close this as resolved. – kaiser Jan 27 '11 at 18:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.