[wp-hackers] plugin template tag function

Matt Read lists at mattread.com
Fri Feb 10 05:40:48 GMT 2006


I think it would be nice if there was a function for calling plugin functions 
from templates; it would check if the function exists etc.

Here's one I came up with:


function plugin_template_tag($function, $args = '') {
	if (is_array($function)) {
		if (is_object($function[0])) {
			call_user_func_array($function, $args);
		}
		elseif (class_exists($function[0])) {
			call_user_func_array($function, $args);
		}
	}
	else {
		if (function_exists($function)) {
			call_user_func_array($function, $args);
		}
	}
}


-- 
Matthew Read
http://www.mattread.com/


More information about the wp-hackers mailing list