diff --git a/inc/utility-functions.php b/inc/utility-functions.php index d8979132..ac4305bd 100644 --- a/inc/utility-functions.php +++ b/inc/utility-functions.php @@ -92,4 +92,37 @@ function pp_series_upgrade_function() } } + + if (!function_exists('pp_series_locate_template')) { + /** + * Check if template exist in theme/child theme + * + * We wouldn't use wordpress locate_template() + * as it support theme compact which load + * default template for files like sidebar.php + * even if it doesn't exist in theme + * + * @param array $template + * @return void + */ + function pp_series_locate_template($template_names) + { + $located = false; + foreach ( (array) $template_names as $template_name ) { + if ( ! $template_name ) { + continue; + } + if ( file_exists( STYLESHEETPATH . '/' . $template_name ) ) { + $located = STYLESHEETPATH . '/' . $template_name; + break; + } elseif ( file_exists( TEMPLATEPATH . '/' . $template_name ) ) { + $located = TEMPLATEPATH . '/' . $template_name; + break; + } + } + + return $located; + + } + } ?> diff --git a/readme.txt b/readme.txt index 4b4e6f67..30a46067 100644 --- a/readme.txt +++ b/readme.txt @@ -139,6 +139,7 @@ v2.7.1- [===unreleased===] * Added: Allow users to customize buttons #311 * Added: "Click to view" for "Series Table of Contents URL" #320 * Added: Add series group template to PRO version group addon #202 +* Fixed: Sidebar warning for theme without sidebar.php on custom template #335 v2.7.0- 2021-11-17 * Fixed: Clarify what HTML is allowed in templates #273 diff --git a/seriestoc.php b/seriestoc.php index 75b316b5..db88f01e 100644 --- a/seriestoc.php +++ b/seriestoc.php @@ -25,5 +25,9 @@ - + \ No newline at end of file