Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #346510

    Hi,

    We have added a new widget area to an enfold child, which calls and displays nicely in the visual editor. However, we want to add this widget area to all pages within our custom post type.

    In the theme template files, what PHP code would I use to call the custom widget with the name “Custom Widget 1”?

    Using the WP widget code here should work for this? http://codex.wordpress.org/Function_Reference/the_widget

    #346977

    Hi!

    In this case what you need to use is dynamic_sidebar to render a Widget Area.

    Best regards,
    Josue

    #347825

    Hi Josue,

    We achieved this a little differently by using the theme shortcode for this in the template – shortcodes we found when digging about in the DB for this…

    It worked really well for this. So we added the sidebar into a test post, copied the shortcode for this, and used the following to insert this into the relevant template where we wanted it:

    <?php echo do_shortcode("[YOURSHORTCODE]"); ?>

    Described here: http://silicondales.com/tutorials/wordpress-tutorials/use-shortcodes-wordpress-theme-files/

    Its a fairly complex thing, and not something I think many of your ordinary users will be able to cope with, but thought I’d say what worked for us!

    Just wondered if there was a php trigger we could have used instead (also needed to know how you’d named the sidebars too, without digging in your source).

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘PHP Code for Widget Area’ is closed to new replies.