I am trying to extend the plugin Cleverness to do list by putting my own customizations in a separate plugin, however, I'm not able to access any methods/properties from the cleverness-todo-list plugin.
There is a display() function inside the original plugin that I want to customize. I want to show the "completed" todo items as well, which, if I was just to hack the original plugin all I would need to do is add these two lines of code in the display function in the cleverness-to-do-list-frontend.class.php:
$this->list .= '<h1>Completed Todos</h1>';
$this->loop_through_todos( 1, $category );
But I'm not sure how to access $this, $this->list, or $this->loop_through_todos() from inside my own custom plugin without touching the original plugin.
I tried to just include the files where those methods/properties come from, and then call the function like I normally would, but it's not working and I'm not sure what to do.
function clever_travel_list()
{
if ( ! is_admin() ) {
//lines 710/711 of cleverness-to-do-list-frontend.class.php
include_once ABSPATH . 'wp-content/plugins/cleverness-to-do-list/includes/cleverness-to-do-list.class.php';
include_once ABSPATH . 'wp-content/plugins/cleverness-to-do-list/includes/cleverness-to-do-list-frontend.class.php';
$this->list .= '<h1>Completed Todos</h1>';
$this->loop_through_todos( 1, $category );
die(ClevernessToDoList::$list);
}
}
add_action('ctdl_list_items', clever_travel_list);
with the $this I get the following error:
Fatal error: Using $this when not in object context in /Applications/AMPPS/www/wpplugin/wp-content/plugins/clever-extension/clever-extension.php on line 11
So how do I access properties/methods when I'm extending a plugin with another plugin?