Created
March 7, 2022 13:33
-
-
Save bporcelli/67e48551f16228bb32d1c1886d2b7aa9 to your computer and use it in GitHub Desktop.
[Table Rate Shipping] Adds support to override the shipping table list template by copying it to a theme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Makes it possible to override the TRS table list template by copying | |
* it to `table-rate-shipping/shipping-table-list.php` in a theme. | |
* | |
* @param string $template_path Path to TRS table list template. | |
* | |
* @return string Template path. | |
*/ | |
function filter_trs_tables_template_path( $template_path ) { | |
$override = locate_template( array( 'table-rate-shipping/shipping-table-list.php' ) ); | |
if ( $override ) { | |
$template_path = $override; | |
} | |
return $template_path; | |
} | |
add_filter( 'trs_table_list_view_path', 'filter_trs_tables_template_path' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment