Calling a custom sidebar

I have created a custom page, in that page, at the bottom i have

 get_sidebar('devSideBar');

in the page sidebar-devSideBar.php i have at the top and bottom

if ( ! is_active_sidebar( 'devSideBar' ) ) { return; } ?>;

<?php dynamic_sidebar( 'devSideBar' ); ?>

That should work…but my custome pages is receiving the regular sidebar not the custom one.
Thx
D

Do you have a template file called sidebar-devSideBar.php?

yes, i believe i put that in the post.
d

Yes, you did put that in the post. What you didn’t put is that you are using WordPress (it looks like it but confirmation is always nice ;)) and at least the name of the template you’re using just in case that there’s any specifics about the template that we should know.

Of course, if you’re using a paid template it may be harder to fix because you don’t know if they’ve added any functionality that may interfere

Can you view your custom sidebar in wp-admin at Appearance > Widgets? If not then your sidebar isn’t registered. You need to register your sidebar first to be able to add it anywhere in theme. Use register_sidebar() to register a sidebar & call this function on widgets_init action.

asp_funda thank you for your advice, registering in the my child function.php did bring up the sidebar in the widget wp-admin page if not yet on the actual page. The widget-init did not seem to be necessary and it actually threw an error when i tried to add it to the function.php.
So will try a few things and see if I can figure out why it is not showing on the page.
If you have any other advice on please let me know.
thank you
D

asp_funda, thanks again! you did def point me in the right direction.
It worked when i changed the code in the “sidebar-devSideBar.php” to call the registerd sidebar numerically

<?php
/**
 * The devSideBar Sidebar
 */
if ( ! is_active_sidebar( 'sidebar-4' ) ) {
	return;
}
?>
<div id="devSideBar" class="devSideBar" >
	<?php dynamic_sidebar( 'sidebar-4' ); ?>
</div><!-- #devSideBar end -->

but in the custom page is still called it by the name

<?php get_sidebar( 'devSideBar' ); ?>

don’t know if it is elegant or not, & not 100% sure why it would work this way. But it does.
thx
D

Well, widgets_init is the recommended hook to register sidebars on. So you’d do it like:

add_action( 'widgets_init', function() {
    register_sidebar( array(
        'name' => 'Right Sidebar',
        'id' => 'right-sidebar',
        'description' => '',
        'class' => '',
        'before_widget' => '',
        'after_widget' => '',
        'before_title' => '',
        'after_title' => '',
    ) );

    register_sidebar( array(
        'name' => 'Bottom Sidebar',
        'id' => 'bottom-sidebar',
        'description' => '',
        'class' => '',
        'before_widget' => '',
        'after_widget' => '',
        'before_title' => '',
        'after_title' => '',
    ) );
} );

And then when you need to call a sidebar, you’d do:

if ( is_active_sidebar( 'right-sidebar' ) ) {
    dynamic_sidebar( 'right-sidebar' );
}

following code in sidebar-devSideBar.php is not worth anything:

if ( ! is_active_sidebar( 'sidebar-4' ) ) {
	return;
}

because get_sidebar() calls locate_template() to load the template which is done using require statement.