-
Notifications
You must be signed in to change notification settings - Fork 430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Override TGMPA plugins on parent theme from child theme #605
Comments
Hi @madastro, without knowing more about how the parent theme has been set up, I can only give you solution directions. Here are a few options which come to mind:
Pro-tip: make sure you include TGMPA in the child-theme just in case the parent would decide to ditch TGMPA.
I'm not sure what you mean by "display the added required plugin list in the dashboard". TGMPA does not display anything on the dashboard page. However, it will add a menu item to install required/recommended plugins, but only if these plugins aren't installed already. Does that help ? If this doesn't answer your question, please clarify and I'll try and help. |
Thanks @jrfnl for the detailed response and will try what you have outlined and will give an update. Regarding the plugin display, sorry, I meant the list under Appearance->Install Plugins, and yes I try to install/uninstall the plugins for testing. |
Depending on how the parent theme has configured the location for TGMPA and/or whether there are plugins installed which use TGMPA and may have a different location configured, the TGMPA admin page can be located at any location in the admin menu, not just the default Appearance->Install Plugins. You could use the Debug Bar in combination with the Actions and Filters add-on to check which functions are registered to the Do you see the admin notice ? and if not: did you ever dismiss it ? |
@jrfnl thanks again for the detailed response. I've tried the example code on your first reply and have not gotten it to work yet, so I'm still investigating. The parent theme isn't pluggable so I've used the second option, below is the code so far: // Setup child plugins
add_action( 'after_setup_theme', 'child_theme_plugins' );
function child_theme_plugins() {
add_action( 'tgmpa_register', 'register_theme_plugins' );
}
// Remove parent plugins
add_action( 'after_setup_theme', 'remove_parent_plugins', 11 );
function remove_parent_plugins() {
remove_action( 'tgmpa_register', 'parent_plugins' );
}
// Register plugins
function register_theme_plugins() {
$plugins = array(
array(
'name' => 'FV Top Level Categories',
'slug' => 'fv-top-level-cats',
'required' => false,
),
);
} Once that's in, the TGMPA notice disappears and the 'Install Plugins' menu under Appearance as well, and when I comment out the I tried a couple of stuff as well, like removing the priority part (11) in the remove_parent_plugins hook. I've also switched the order of the code by moving the parent plugin hook before the child, but I get the same issue. I've also updated TGMPA on both parent and child for testing, but I get the parent_url_slug error, so I'm still looking into the configuration. Anyway, will comment once I've figured out a few things. Thanks again. |
Alrighty, this is working for me now and have resolved the slug error on update. Thanks @jrfnl for all the detailed help. Cheers! |
@madastro Glad to hear you've got it working. One thing I noticed about the code you posted earlier: make sure when you define your plugins array to also call the tgmpa( $plugins ); I'd suggest you have a look at the example file and the configuration help page for more info if you still need it. |
I have a parent theme, pre-built, which uses TGMPA and would like to override the defined plugins via a child-theme so that I don't have to edit anything on the parent in case of updates. Is this possible?
Also, I've also tried using TGMPA, for loading plugins which are used by the child-theme only, but it does not display the added required plugin list in the dashboard.
the functions.php on the child theme has this:
The text was updated successfully, but these errors were encountered: