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




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

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

  • Because I'm not sure how I would include two different widget areas in a sidebar? 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. 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. 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. Feb 7 '13 at 16:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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