Hi @hube2 , thanks for the help.
Your first comment unfortunately didn’t work – same results as before. For the wp_add_inline_script option, how do I add my php into that script?
The following code causes issues because I’m trying to put PHP in a JavaScript string (the $data parameter of wp_add_inline_script), I think:
<?php
wp_add_inline_script('swiper', '
var swiper = new Swiper(".swiper", {
slidesPerView: <?php the_field("slides_per_view"); ?>
});
')
?>