Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter imikehere

    (@imikehere)

    @bvbaked Appreciate you taking the time to actually test it, that helps a lot. it turned out to be a timing issue. I wrapped the initialization in DOMContentLoaded and excluded the script from optimization, and now it’s working consistently. Appreciate the guidance

    Thread Starter imikehere

    (@imikehere)

    @bvbaked Yeah, that makes sense and I appreciate your input. For context, the tool page I’m referring to is https://devicexa.com/tools/gamepad-tester/. It’s a JavaScript-based gamepad tester that listens for controller input and updates the UI in real time. Outside WordPress it works perfectly, but inside WordPress it becomes inconsistent sometimes the script loads properly, and other times parts of the interface don’t respond or freeze.
    I am already using wp_enqueue_script, so the script is being loaded the WordPress way, but I suspect the issue might be related to script dependencies, load order, or possible conflicts with the theme or optimization plugins. It could also be that caching or minification is altering the execution order of the script, or the theme is interfering with the DOM before the script fully initializes. Right now I’m enqueueing it without any dependencies, so I’m considering adding things like jquery if needed, and also making sure the initialization runs after the full page load using DOMContentLoaded or window.onload. I’m also planning to fully test it with all optimization plugins completely disabled to rule out any interference. If you’ve seen this kind of issue before where a tool works outside WordPress but behaves unpredictably inside it, I’d really like to know what you would check first whether it’s enqueue order, plugin conflicts, or script execution timing.

    Yeah you can definitely juggle multiple looks, but templates in block themes are kinda one at a time”per post unless you manually assign them. What most people do is create a few custom templates like one for CategoryX, one for CategoryY and then just pick the right one while editing the post. It’s not fully automatic like CSS targeting, but it gets the job done cleanly. For homepage/archive, CSS is still the easiest win since categories already have classes baked in.

Viewing 3 replies - 1 through 3 (of 3 total)