0

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

2 Answers 2

1

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

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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