• Hi there,

    I have a widget that I would like to inset into my template. is this possible?

    I tried using the following:

    <?php echo do_shortcode('[weather]'); ?>

    but it only seems to output the word “[weather]”

    Is there a way to get a list of widget short codes?

    Thanks!

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Widgets and shortcodes are not anywhere close to the same thing. Some devs offer both to do something in particular, but it’s not a given. Widgets are displayed by calling dynamic_sidebar(). Pass the ID of the desired widget area if there is more than one registered for your site. If you need more widget areas, call register_sidebar() from a callback added to “widgets_init”.

    Sidebar and widget area is the same thing. A “sidebar” can occur anywhere, it doesn’t need to be a traditional sidebar on the side of a page.

Viewing 1 replies (of 1 total)
  • The topic ‘display a widget via php’ is closed to new replies.