Deregister scripts if parent page == ‘gallery’
-
I am trying to deregister javascripts that aren’t needed on certain pages, ala Justin Tadlock’s tutorial. The script I have works fine if I specify a specific page, but I would like it to also work on any child pages of the parent specified. Here’s the working code:
function deregister_postTabs_addJS() { if (!is_page('gallery')) { wp_deregister_script( 'postTabs'); } } add_action( 'wp_print_scripts', 'deregister_postTabs_addJS', 200);
Here’s how I would like it to work:
function deregister_postTabs_addJS() { global $post; if (!is_page('gallery') && !($post->post_parent=="3830")) { wp_deregister_script( 'postTabs'); } } add_action( 'wp_print_scripts', 'deregister_postTabs_addJS', 200);
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Deregister scripts if parent page == ‘gallery’’ is closed to new replies.