Support » Plugin: Pods - Custom Content Types and Fields » Pods Template function callback

  • Resolved


    so far I have had something like this in my custom Pods Template:


    …which worked just fine. “kka_get_pods” is the function in my theme’s “functions.php” and returns a chunk of HTML.

    However, I had to move “kka_get_pods” function to the plugin due to the fact that certain things belong to plugin territory. Anyhow…

    The question is: how do I call/access my function that is now part of the plugin?

    I’ve tried:


    …but it doesn’t seem to work.

    My function is public and declared inside the class. Somewhat standard thing.

    class My_Plugin {
    	private static $instance;
    	public static function get_instance() {
    		if( ! self::$instance ) {
    			self::$instance = new self();
    		return self::$instance;
    	public function init() {
    		// nothing to init yet
    	public function kka_get_pods() {
    		// code
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Jory Hogeveen


    Hello @dameerdj ,

    My_Plugin::kka_get_pods is a static call so you need to declare your function as static: public static function kka_get_pods().
    I’m actually uncertain whether this will work at all but since static calls work relatively similar to regular functions I think it might!

    Regards, Jory


    Forgot to mention that I already tried to declare it as a static function and it didn’t work as well.

    Is there any workaround to the problem? I mean, you are Pods developer, there must be something.

    Thanks for any hint in advance!

    Plugin Author Jory Hogeveen


    I found a bottleneck in the code. It validates through function_exists and in your case it’s not a function.

    A workaround for now is to create a function within your plugin that calls the class method.

    I’ve made a PR on GitHub to discuss this topic with a possible solution.

    I’ll close this topic here in favor of GitHub. Thanks for your report!

    Cheers, Jory

    Plugin Author Scott Kingsley Clark


    We’ve merged this PR into our next maintenance release going out this month. Thanks for your understanding here @dameerdj


    That’s awesome, thanks a lot guys!!!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Pods Template function callback’ is closed to new replies.