Adding custom html and standard widgets to sidebar

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:

Read More
    <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

Related posts

Leave a Reply

3 comments

  1. 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' ); ?>
    
  2. 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) -->