Skip to content

Switch slider templates to include + function_exists guards (v1.1.29)#99

Open
nilay49 wants to merge 1 commit into
mainfrom
slider_v1.1.29
Open

Switch slider templates to include + function_exists guards (v1.1.29)#99
nilay49 wants to merge 1 commit into
mainfrom
slider_v1.1.29

Conversation

@nilay49
Copy link
Copy Markdown
Contributor

@nilay49 nilay49 commented May 27, 2026

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.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant