• Hi,

    Thank you for this really well built plugin.

    Im just starting integrating it with my Timber workflow, which requires me to do some substantial templating to achieve total controlo over the layout.

    The first step was to try having the plugin loading templates from a custom location on my theme structure, but I would rather not having all the files at the root of the theme, so I was declaring it like this:

    add_filter( 'eventorganiser_template_stack', 'my_callback_function' );
    function my_callback_function( $stack ){
    
        $new_array[] = CHILD_DIR . "/events";
        array_unshift( $stack, CHILD_DIR . "/events" );
        var_dump($stack);
    
    	return $stack;
    
    };

    This does seem to do what was expected, the dump above returns the following:

    array(4) { [0]=> string(49) "/var/www/html/wp-content/themes/wip-avenue/events" [1]=> string(42) "/var/www/html/wp-content/themes/wip-avenue" [2]=> string(41) "/var/www/html/wp-content/themes/wip-roots" [3]=> string(58) "/var/www/html/wp-content/plugins/event-organiser/templates" }

    The first item in that array is returning the correct path where I have my templates, but nothing happens on the front-end and is still loading the default templates.

    Am I missing something here?

    Thanks.

    https://www.ads-software.com/plugins/event-organiser/

Viewing 1 replies (of 1 total)
  • Plugin Author Stephen Harris

    (@stephenharris)

    Hi lmartins,

    It’s not clear from the documentation, but that filter is for non-page templates – by which I mean templates which don’t form part of WordPress’ template hierarchy (e.g. templates for shortcodes/widgets).

    For page templates, the plug-in simply swaps in the default template if WordPress doesn’t find the appropriate template in the child/parent theme.

    (Although in 3.0.0, Event Organiser will be splitting up the default templates to use template partials to remove code duplication – the plug-in will use the above filter to find those partial templates).

    Anyway, in short, WordPress’ default behaviour is to look for archive-event.php and single-event.php in the root of your theme, and Event Organiser doesn’t change that. But you can use this filter: https://hookr.io/filters/type_template/ to point it elsewhere.

Viewing 1 replies (of 1 total)
  • The topic ‘Cant get the templates stack filter to work’ is closed to new replies.