Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Just wondering is it possible to add HTML code after the fisrt widget in a sidebar so that it would only show once and not repeat after a second or third widget is added?

This is what I have so far:

      if (function_exists('register_sidebar')) {
register_sidebar(array(
    'id' => 'sidebar2',
    'name' => __('Sidebar 2'),
    'description' => __('The Second sidebar (Magazine link).'),
    'before_widget' => '<div id="%1$s" class="widget %2$s">',
    'after_widget' => '</div><div class"content">Here only once</div>',
    'before_title' => '<h4 class="widgettitle">',
    'after_title' => '</h4>',
));

}

Thanks

share|improve this question

2 Answers 2

Register separate sidebar for the first widget and add requred HTML between sidebars in template file(s).

<?php dynamic_sidebar('First Widget Sidebar'); ?>
<div class"content">Here only once</div>
<?php dynamic_sidebar('Other Widgets Sidebar'); ?>
share|improve this answer
    
Thanks, that's pretty much what I ended up doing. –  a_knife_a_fork Feb 13 '13 at 17:11

Just do a different first widget? or im getting badly what you need?!

share|improve this answer
    
Because I'm not sure how I would include two different widget areas in a sidebar? –  a_knife_a_fork Feb 7 '13 at 13:59
    
im really not sure what is your question. But for what i realize you´ve one sidebar widget. Inside of if you can drag and drop whatever you want...you can put a "text area" at top and code your html. –  jose pacheco Feb 7 '13 at 15:02
    
It's ok I figured it out, I basicly wanted to add some code between to widgets, I thought I could be fancy and do it in functions but now I see it was easier to do it in sidebar.php. Thanks for your time. –  a_knife_a_fork Feb 7 '13 at 15:53
    
np...glad you found a solution :D you could also edit or post a reply solution for further needs. maybe some ppl has the same issue and find your answer useful. –  jose pacheco Feb 7 '13 at 16:16

Your Answer

 
discard

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.