Title: OOP Plugin &#8211; Exposing Class Functions
Last modified: August 20, 2016

---

# OOP Plugin – Exposing Class Functions

 *  [edtiley](https://wordpress.org/support/users/edtiley/)
 * (@edtiley)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/oop-plugin-exposing-class-functions/)
 * 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)

[←](https://wordpress.org/support/topic/oop-plugin-exposing-class-functions/?output_format=md)
[1](https://wordpress.org/support/topic/oop-plugin-exposing-class-functions/?output_format=md)
2

 *  Thread Starter [edtiley](https://wordpress.org/support/users/edtiley/)
 * (@edtiley)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/oop-plugin-exposing-class-functions/page/2/#post-3532941)
 * 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](https://wordpress.org/support/users/edtiley/)
 * (@edtiley)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/oop-plugin-exposing-class-functions/page/2/#post-3533016)
 * 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)

[←](https://wordpress.org/support/topic/oop-plugin-exposing-class-functions/?output_format=md)
[1](https://wordpress.org/support/topic/oop-plugin-exposing-class-functions/?output_format=md)
2

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

## Tags

 * [oop](https://wordpress.org/support/topic-tag/oop/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 17 replies
 * 2 participants
 * Last reply from: [edtiley](https://wordpress.org/support/users/edtiley/)
 * Last activity: [13 years, 5 months ago](https://wordpress.org/support/topic/oop-plugin-exposing-class-functions/page/2/#post-3533016)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
