0

EDIT: For those who are interested as per Tom J Nowell the problem was that I used it with my own custom widget which doesn't have before and after support.

I have this sidebar and everything works fine except that the before and after widget don't show up:

register_sidebar( 
    array(
    'name'          => 'Footer Three',
    'id'            => 'footer-three',
    'before_widget' => '<div class="footer-three-wrapper">',
    'after_widget'  => '</div>',
    ) 
); 

And inside page:

<?php dynamic_sidebar( 'footer-three' ); ?>

Isn't before_widget and after_widget supposed to show up?

  • 3
    In theory yes, but have you tested this with a standard widget? The Widget is responsible for outputting it, and if you forget to do that then it doesn't show – Tom J Nowell May 7 '18 at 13:24
  • OK I got it. I used it with my custom widget and I hadn't bothered to include before and after. Thanks. Is there a way I mark it as Answer? – user7432810 May 7 '18 at 14:19
  • please make a proper answer from your edit and accept it – Mark Kaplun May 7 '18 at 14:22
  • Answering your own question lets us vote it up and give you rep :) – Tom J Nowell May 7 '18 at 15:15
0

Thanks to Tom J Nowell I found out that the reason for after_widget and before_widget NOT appearing was that I used my own widget and inside my own widget I had commented out:

        //echo $args['before_widget']; 

and

        //echo $args['after_widget']; 

So as soon as I tested it with the default wordpress "Custom HTML" everything worked fine and before_widget and after_widget appeard as expected.

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.