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>
                    </div>


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

            <p>Content goes here<p>

        </div>
                    </div>

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

Thanks for any help

link|improve this question

71% accept rate
Please mark one of these answers as "best" so it will be removed from the unanswered list. – MikeSchinkel Feb 1 '11 at 3:35
feedback

3 Answers

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' ); ?>
link|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
feedback

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.

link|improve this answer
feedback

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(); ?>
    </div>
    <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' ) ) :

        the_widget(
            'WP_Widget_Text'
            ,array(
                'title'     => 'Textwidget'
                ,'text'     => '
                    <p>
                        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. 
                    </p>
                '
                ,'filter'   => ''
            )
            ,array(
                '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' );
    endif;
?>

</div>
<!-- END Sidebar right (default) -->
link|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
feedback

Your Answer

 
or
required, but never shown

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