• I’m trying to build a plugin in OOP fashion using Tom McFarlin’s excellent plugin boilerplate.

    In the constructor I have:

    add_action( 'end_loop', array( $this, 'hereman1' ) );

    In the core funtion area I have:

    public function hereman1() {

    It is my understanding that a public function should be callable from outside the object, but when my single page template trys to call the function I get a Fatal Error that says the function is undefined.

    I can call the function if my template calls myobj::hereman1()

    What am I doing wrong?

Viewing 2 replies - 16 through 17 (of 17 total)
  • Thread Starter edtiley

    (@edtiley)

    Again, perhaps it is that the function was returning a string, rather than using echo.

    I’ll smash this out on the morrow.

    Thanks

    Ed

    Thread Starter edtiley

    (@edtiley)

    Sorry for the lag in replying, it has been quite the week.

    It was in fact that the function was returning a value that was not getting printed properly.

    When echo was substituted for return in the function, it worked as expected.

    Thanks for helping me clarify all that.

Viewing 2 replies - 16 through 17 (of 17 total)

The topic ‘OOP Plugin – Exposing Class Functions’ is closed to new replies.