I'm probably making a mess of this...
I'm trying to add a filter to the_content that will add a method from an external class, but keep going round in circles.
Can anyone point me in the right direction??
class MyClass {
var foo;
var bar;
function myMethod($id) {
// some code
}
}
I'm stuck on accessing myMethod($id)
from within a plugin filter like so:
function extendPost($content, '') {
global $post;
$id = $post->ID;
$class = new MyClass();
// this is where i get stuck
$myMethod = $class->myMethod($id) // ??;
$content.= "<div>" . $myMethod . "</div>";
}
add_filter('the_content', 'extendPost');
Any help would be ace. I'd really like to get some sleep tonight ;)