Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 5 years ago.
Improve this questionI am using a WordPress theme (Kalium Theme) as a base and extending it with my own child theme, which includes javascript & php files. The parent theme uses a image carousel plugin (Flickity) to display e.g. product image galleries doesn't work exactly the way I want it to. I need access to the flickity instance outside of the Kalium main libraries. Can you advise me on how best to access the carousel objects and manipulate them in javascript without directly changing Kalium Core files? I am talking about adding event listeners to the flickity instance and changing settings in the instance.
Closed. This question is off-topic. It is not currently accepting answers.Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 5 years ago.
Improve this questionI am using a WordPress theme (Kalium Theme) as a base and extending it with my own child theme, which includes javascript & php files. The parent theme uses a image carousel plugin (Flickity) to display e.g. product image galleries doesn't work exactly the way I want it to. I need access to the flickity instance outside of the Kalium main libraries. Can you advise me on how best to access the carousel objects and manipulate them in javascript without directly changing Kalium Core files? I am talking about adding event listeners to the flickity instance and changing settings in the instance.
Share Improve this question asked Mar 27, 2020 at 15:16 hjXPYk22hjXPYk22 31 bronze badge 3 |1 Answer
Reset to default 0You would access it the same way that Kalium does. Code in child and parent themes all have access to the same things, there is no sandboxing or walls of separation dividing the two. Any functions or variables in the parent theme are accessible in the child theme the same way they'd be in the parent.
Having said that, overriding PHP functions and classes in the parent theme may not be possible if they don't provide actions and filters, and can't be unhooked.
Similarly, javascript is javascript, once it's loaded into the browser page, it has very little to do with WordPress and parent/child themes. You'll probably have to deregister the parent themes javascript and then add your own that does everything the parent theme does, but your way.
Fundamentally, the only people who can definitively answer your question are the Kalium support routes, and other people who use Kalium.
var thumbCarousel = new Flickity($productThumbnails[0], { asNavFor: $mainProductImages[0], wrapAround: false, cellAlign: 'left', prevNextButtons: false, pageDots: false, contain: true, });
– hjXPYk22 Commented Mar 27, 2020 at 15:39