Hi,
The template library is based on JS and REACT. So, unfortunately, there is no available hook for that.
You can use CSS to hide the library button.
Please add the following code to your theme freuntions.php file to hide the library button.
add_action('admin_head', 'my_custom_fonts');
function my_custom_fonts()
{
echo '<style>
#extendify-templates-inserter-btn{
display: none!important;
}
</style>';
}
Hi, Thanks for the prompt response.
Yeah, I did have a look through the code and couldn’t see a hook or filter.
I’d considered the CSS route, it feels a bit “hacky” to have the library in memory but hidden.
It might be good to provide a way for users to turn that feature off. I understand for small businesses with one person making their own site it’s probably good – but for web-devs supplying a concise editor to a client with 20 staff who have access to the Editor role … it’s a recipe for disaster!
I investigated forking to see if I can make the enqueue conditional on user role and an options page, or current_user_can().
For example: /plugins/editorplus/index.php (line 16)
require_once plugin_dir_path(__FILE__) . 'extendify-templates-sdk/class-templates-sdk.php';
But for now I’ve done a rather brutal local fork by commenting out the require_once , but thanks again for your work here with this plugin and the quick response.
– Steve
Hi, what I did today is a different horrible fork, but it would be a better place for you to put a filter.
Line 90 of class-templates-sdk.php on my development version now looks like this, and will probably stay this way.
if ( current_user_can( 'manage_options' ) ) {
self::$instance = new Self();
self::$instance->init();
self::$instance->includes();
}
Naturally that’s not idea for you guys, but I suggest some conditional there from your options-general.php?page=editor_plus#/general might be a good idea.
Otherwise everyone will be forking like I did!
thanks again
Thanks for your investigation. I will forward this to the development team.
Hi @steve-pheriche
I wanted to let you all know that we have added two options for removing the library button from the editor.
1) First, if you go to the preferences section of the editor (by clicking the three dots in the upper right corner), you will see an option ‘Disable Extendify’ which will remove the library for whichever user selects it.
2) Alternatively, you can add the following as a mu-plugin and it will remove the library for all users of the site.
add_filter('extendifysdk_load_library', '__return_false');
Let us know if you need anything else!
Chris