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

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')) {
    '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>',



share|improve this question

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


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.