• Resolved sannin

    (@sannin)


    Hi,

    I am using Oxygen builder on all my sites, and it completely disables wordpress themes, so overriding templates does not work.

    Although there is a workaround using a plugin that reenables the theme functionality, using a filterable template location is more elegant solution!

    There is a similar filter at woocommerce, “woocommerce_locate_template” that i use for the same reason.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor digamberpradhan

    (@digamberpradhan)

    We’ve addded the cm_typesense_locate_template filter to version 1.1.9 of the plugin. You will need to return a complete file path via the filter – note if file does not exist, it will not load.

    Thread Starter sannin

    (@sannin)

    Thank you for this one, too!

    This is my custom code i confirm it works:

    function intercept_ts_template( $template, $file, $args ) {
    
            $template_directory = trailingslashit( plugin_dir_path( __FILE__ ) ) . 'templates/typesense/';
            $path = $template_directory . $file;
    
            return file_exists( $path ) ? $path : $template;
    
    }
    add_filter( 'cm_typesense_locate_template', 'intercept_ts_template', 10, 3 );

    I don’t know if it will work for anyone i write all my custom code to a plugin i have made for that purpose.

    Plugin Contributor digamberpradhan

    (@digamberpradhan)

    Great to hear. I’ll mark this as resolved.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Filterable template override path’ is closed to new replies.