Switch slider templates to include + function_exists guards (v1.1.29)#99
Open
nilay49 wants to merge 1 commit into
Open
Switch slider templates to include + function_exists guards (v1.1.29)#99nilay49 wants to merge 1 commit into
nilay49 wants to merge 1 commit into
Conversation
Root cause of empty front-end slider when used inside ACF Flexible Content: shortcode handler ran twice per request (Yoast SEO running the_content for meta generation, then the actual page render). include_once on the template file no-op'd the second call, so the template's ob_start/ob_get_clean/echo never executed and only the echoed debug scripts ended up in the parent buffer. Switching include_once -> include lets the template re-run each call. Guarding the helper functions (getStarRating, getStarRatingWidget, randomColor, isMobileDevice) with function_exists() prevents the fatal "Cannot redeclare function" on the 2nd include. Also expanded the temp diagnostic block: per-invocation counter, backtrace, ob_get_level snapshots, before/after-include HTML markers, window var per invocation, and a parallel error_log line. Remove the DEBUG blocks once verified on bloorkidsdental.com. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause of empty front-end slider when used inside ACF Flexible Content: shortcode handler ran twice per request (Yoast SEO running the_content for meta generation, then the actual page render). include_once on the template file no-op'd the second call, so the template's ob_start/ob_get_clean/echo never executed and only the echoed debug scripts ended up in the parent buffer.
Switching include_once -> include lets the template re-run each call. Guarding the helper functions (getStarRating, getStarRatingWidget, randomColor, isMobileDevice) with function_exists() prevents the fatal "Cannot redeclare function" on the 2nd include.
Also expanded the temp diagnostic block: per-invocation counter, backtrace, ob_get_level snapshots, before/after-include HTML markers, window var per invocation, and a parallel error_log line. Remove the DEBUG blocks once verified on bloorkidsdental.com.