WordPress Load Sidebar Based on Parent Page and Child Pages

This will load a particular sidebar based on the page id and will load the same sidebar on all child pages of which the main page is the parent.

Use this in the sidebar page:

1) Detect if page has a parent page and if so get the parent page id:

<?php
       //get parent id
       if ($post->post_parent) {
           $parentID = ($post->post_parent);
        }
?>

2) Load appropriate sidebar based on parent id and otherwise load a default sidebar

<?php 
if (  is_active_sidebar( 'walking-navigation-area' ) && ($parentID == '1731' || is_page('1731'))) : 
                dynamic_sidebar( 'walking-navigation-area' ); 
elseif(  is_active_sidebar( 'kayaking-navigation-area' ) && ($parentID == '1724' || is_page('1724'))) : 
            	dynamic_sidebar( 'kayaking-navigation-area' );
elseif(  is_active_sidebar( 'default' )): 
              dynamic_sidebar( 'default' );
endif;
?>