• Resolved SIM_Admin

    (@sim_admin)


    I cannot tell from the one php file — simple-page-sidebars.php how the custom sidebars are registered; by name or ID? Other than the IDs would begin with ’20’ — add_action( ‘widgets_init’, array( __CLASS__, ‘register_sidebars’ ), 20 );

    with this line of code — I can only assume they are registered by ID. Nonetheless, where may I find the IDs for the custom sidebars I create using the plugin?

    I have named a custom sidebar “Workshops”. If I want to access this specific sidebar using say: dynamic_sidebar( ‘?’ ) and the wordpress rule is: “If your sidebars were registered by number, they should be retrieved by number. If they had names when you registered them, use their names to retrieve them.”

    http://wordpress.org/plugins/simple-page-sidebars/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Brady Vercher

    (@bradyvercher)

    Normally you shouldn’t need to modify the code in your templates, but if you want to display a sidebar created via the plugin, you should be able to use the name of the sidebar itself in the dynamic_sidebar() call.

    The sidebars are registered with IDs as well. They’re based on the name of the sidebar (all lower-case and spaces converted to dashes) and prefixed with “page-sidebar-“.

    Using your sidebar name of “Workshops,” either of these should work:

    dynamic_sidebar( 'Workshops' );
    dynamic_sidebar( 'page-sidebar-workshops' );

    The ’20’ from above is the priority of that hook so that it’s executed after native theme sidebars, allowing the native sidebars to display above custom sidebars on the widgets screen in the dashboard.

    Thread Starter SIM_Admin

    (@sim_admin)

    Brady, thank you for getting back with me. I am trying something, will get back to you.

    Thread Starter SIM_Admin

    (@sim_admin)

    Thanks Brady. I got what I wanted… using <?php if ( ! dynamic_sidebar( ‘page-sidebar-workshops’ ) ) : ?> WORKED! Thanks again.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to get sidebar id or name’ is closed to new replies.