I understand you can add extra CSS on top of the parent theme, but how do you remove PHP code from functions.php?
I want to remove the Masonry plugin
in twentyfourteen
theme, and have located the piece of code on line 254
.
if ( is_active_sidebar( 'sidebar-3' ) ) {
wp_enqueue_script( 'jquery-masonry' );
}
If I’m editing the parent theme, I can just comment this block out /* */
.
But I’m not aware of a way to change this is my child theme.
You can’t actually “remove” PHP code from the parent theme. What you can do is undo things done there.
The counterpart of
wp_enqueue_script
iswp_dequeue_script
.If you put this in your
functions.php
it should remove theMasonry Plugin
(untested)Source: Function Reference/wp dequeue script @ Codex
As I haven’t tested this be aware of the fact that this could have unwanted side effects if the theme relies on the
Masonry Plugin
.I think, if your problem its just that script, you just can deregister it your child theme:
High priority of add_action ensures it runs at the end.