Follow this step for Only one page add custom sidebar
Step 1: Put this code in your theme function.php file. Register custom sidebar and your custom add_action.
function wpdocs_theme_slug_widgets_init() {
register_sidebar( array(
'name' => __( 'Custom Sidebar', 'textdomain' ),
'id' => 'sidebar-10',
'description' => __( 'Widgets in this area will be shown on all posts and pages.', 'textdomain' ),
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '</li>',
'before_title' => '<h2 class="widgettitle">',
'after_title' => '</h2>',
) );
}
add_action( 'widgets_init', 'wpdocs_theme_slug_widgets_init' );
add_action( 'your_custom_hook_name', 'your_function_name' );
function your_function_name( $sidebar_name )
{
is_page( 'sample-page' ) && dynamic_sidebar( 'sidebar-10' ); // your sidebar name
remove_action( current_filter(), __FUNCTION__ );
}
Step 2: Put this code where you display this widgets
<?php do_action( 'your_custom_hook_name' ); ?>