Adding parameters to get_template_part( );
-
I would like to add an extra parameter to this function.
ie I want a loop-format.php to be called with a parameter that is unique to each query (category for instance)
I can use;
$parameter = ‘something’;
include(locate_template(‘loop-course.php’));=and then handle $parameter within the include
but that’s just a bit ugly (and I would guess inefficient – I have called it 8 times in one template)
I would like to write;
get_template_part( ‘loop’, ‘course’, ‘something’);I need a filter to add this to the built-in function. But how do I do this?
- The topic ‘Adding parameters to get_template_part( );’ is closed to new replies.