http://wp-event-organiser.com/blog/tutorial/adding-alternative-locations-for-templates/
Can anyone help me with the alternate template locations code ?
add_filter( 'eventorganiser_template_stack', 'my_custom_events_template_directory' );
function my_custom_events_template_directory( $template_stack ){
array_unshift( $template_stack, plugin_dir_path**( __FILE__ )** );
return $template_stack;
}
What should be entered at ( FILE ) ?
I see this shown after the main code , do i replace the code above with this and an use an absolute path?
add_filter( 'eventorganiser_template_stack', 'my_custom_events_template_directory' );
function my_custom_events_template_directory( $template_stack ){
array_unshift( $template_stack, 'absolute/path/to/directory/containing/templates/' );
return $template_stack;
}
bit confused as it’s not working for me.

andytc
Hi Andy,
__FILE__
is magic constant which is the full path and filename of the current file. The plugin_dir_path()
function just returns the parent directory of that path.
So the second argument should be the absolute path (with a trailing slash) pointing to the desired directory. So assuming the absolute path is correct, then the above should work. You might want to add archive-event.php
to that directory and check that file_exists( $absolutepath . 'archive-event.php' )
returns true.

Stephen Harris