WordPress override CM Tooltip plugin function
-
I want to customize the behavior of
CM tooltipplugin.
From what I see in the code the plugin is a class that has the following filters, which are kind of self descriptive.class CMTooltipGlossaryFrontend { /* * FILTERS */ add_filter('get_the_excerpt',array(self::$calledClassName,'cmtt_disable_parsing'), 1); add_filter('wpseo_opengraph_desc', array(self::$calledClassName, 'cmtt_reenable_parsing'), 1); /* * Make sure parser runs before the post or page content is outputted */ add_filter('the_content', array(self::$calledClassName, 'cmtt_glossary_parse'), 9999); add_filter('the_content', array(self::$calledClassName, 'cmtt_glossary_createList'), 9998); add_filter('the_content', array(self::$calledClassName, 'cmtt_glossary_addBacklink'), 10000); }I want to enable/disable the parsing functionality according to my needs ( post type etc).
The plugin code has
get_the_excerptfilter, that checks some conditions and disables the parsing. When thewpseo_opengraph_descgets activated it reanables parsing. The actual parsing happens incmtt_glossary_parsefunction.I wrote a new plugin and tried the following:
1. I wrote my cmtt_disable_parsing function with higher precedence
add_filter('get_the_excerpt', array($this, 'cmtt_disable_parsing'), 100);2. I wrote my cmtt_glossary_parse function which checks the conditions and then calls the CMTooltipClossaryFrontent::cmtt_glossary_parse function
add_filter('the_content', array($this, 'cmtt_glossary_parse'), 10008);but none of them works. Also, when i instantiate the original plugin inside my plugin, the original plugin is not working properly ( it does not parse the content)
Any help would be appreciated on how to customize properly the plugin functionality.
Should i create a new plugin or is it better to put the code in functions.php?
Is it a bad practice to instantiate a plugin class and call its methods somehwere else, lets say inside another plugin?
The topic ‘WordPress override CM Tooltip plugin function’ is closed to new replies.