I dont see the same object in prod, this further confirms that the scrip isnt running at the right time, it must be caching of some sort.
I have added a new filter, wpswiper_frontend_js_register_args
, which allows users to customize specific parameters when enqueueing the frontend-js
script.
Upgrade to v1.2.12
This filter lets you adjust script dependencies (deps
), choose if the script should load in the footer (in_footer
), and specify additional script loading strategies (e.g., async
or defer
).
How to Use This Hook
To modify these parameters, add a filter callback to functions.php
or your custom plugin. Here’s an example that demonstrates the available options:
add_filter('wpswiper_frontend_js_register_args', function($args) {
// Modify script dependencies
// 'wpswiper-bundle-js' must be always declared
$args['deps'] = ['wpswiper-bundle-js', 'your-custom-dependency'];
// Example: Set the script to load in the footer
$args['args']['in_footer'] = true;
// Example: Specify an additional loading strategy, such as async or defer
$args['args'] = ['strategy' => 'defer']; // Options: 'async' or 'defer'
return $args;
});
Explanation of Options
deps
: Use this to add or remove dependencies for the script, ensuring any additional scripts load before frontend-js
.
in_footer
: Set to true
if you prefer the script to load in the footer, reducing load time on the page’s initial render.
args
: Specify additional script loading strategies by setting 'strategy' => 'async'
or 'strategy' => 'defer'
within the args
array.
With this filter, you can fully customise how the frontend-js
script is loaded, making it easier to optimise for your site’s specific needs.
-
This reply was modified 4 months, 2 weeks ago by
digitalapps.