I am trying figure out how to place JavasScript and stylesheet to parent page and children page via functions.php
. The parent page is Our People and children page is staff names.
This is what I wrote:
JavaScript
wp_register_script ('unslider-js', get_stylesheet_directory_uri() . '/library/js/unslider-min.js', array( 'jquery' ),'1',false);
if ( is_page('our-people') && in_array( get_post_ancestors(597) ) ) { wp_enqueue_script ('unslider-js'); }
Stylesheet
wp_register_style ('unslider-css', get_stylesheet_directory_uri() . '/library/css/unslider.css', array(),'', 'all');
if ( is_page() && in_array( get_post_ancestors(597) ) ) { wp_enqueue_style ('unslider-css'); }
It seem that it does not fetch these files for the parent and child page. Could anyone guide me how to achieve this approach?