How to call the widget in template File wordpress?

To call a widget in any template file we can use the default wordpress function called “dynamic_sidebar()”.
If you register a widget with the name “Custom sidebar” then you can you the function like

<?php dynamic_sidebar('Custom sidebar') ?>

or you can use ID .
If the ID of your registered widget is “custom-sidebar” then you can call it like

<?php dynamic_sidebar('custom-sidebar') ?>

You can read here for more about dynamic sidebar function of wordpress
Dynamic sidebar function for wordpress.

Share With Friends

Also Read   add odd or even class in wordpress loop using php

Speak Your Mind


Time limit is exhausted. Please reload CAPTCHA.