How to call upon sidebars within a template file?

Home Page – v1.1 Forums Extensions Sidebars How to call upon sidebars within a template file?

This topic contains 1 reply, has 2 voices, and was last updated by  Andy Wilkerson 3 years, 8 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #4497

    Ross Taylor
    Participant

    How am I supposed to insert this into a template file? I tried <?php get_sidebar(‘name of sidebar created’); ?>, and it doesn’t work? I also tried placing the short code in there but it just shows the short code and does not display?

    #4498

    Andy Wilkerson
    Keymaster

    You should be able to use the WP default dynamic_sidebar( 'id' ) function. If you use this directly, prefix the alias with generated_sidebar-{your alias} to get the correct ID. For example, a sidebar with the alias “default” would be:

    dynamic_sidebar( 'generated_sidebar-default' );

    Also, you can use the shortcode directly into the PHP template with:

    echo do_shortcode( '[sidebar alias="alias"]' );

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

Fork us on Github.

Runway on Github

Learn with User Guides.

View the Guides


Thank you for being a part of Runway. We hope you have a great experience and together we can make Runway one of the best additions to the WordPress ecosystem and theme development. We're excited to have you here!

escort kutahya escort bornova escort beylikduzu escort amasya escort diyarbakir
Google+