Hi Josh,
You would just adjust the conditional as needed.
Here’s the documentation for is_page(): https://developer.wordpress.org/reference/functions/is_page/
As you can see, you can pass it an array of IDs if you would like it to match multiple pages.
Hope that helps,
Chris
Hey Chris,
Thanks!
I had to build the array inside the Function. For some reason it would disable all of ShiftNav when the array was built outside of the code.
add_action( 'wp_head' , 'remove_shiftnav' );
function remove_shiftnav(){
if( is_page(array(1638, 1013, 1278, 1502)) ){
remove_action( 'wp_footer', 'shiftnav_direct_injection' );
}
}
But thank you works great.
Josh
-
This reply was modified 9 years, 5 months ago by
joshuanovak.
Hi Josh,
You’re welcome, glad it helped! Yes, due to variable scope, it’s simplest to define the array within the function. Due to the scope of the variable, if you defined the variable outside of the function, you were likely passing is_page() a null value (undefined variable), which would return true on every Page – therefore disabling ShiftNav on every page.
Glad you got it sorted 🙂
Best,
Chris