-
Mykola
Hi. I’d like to make a reusable image slider. Let’s say I use this one https://www.w3schools.com/howto/howto_js_slideshow.asp
It has three parts: HTML, CSS, JS
CSS: goes into global styles
HTML: add it through patterns, then ‘detach’ it when adding to a new page, and edit the URLs with new images.
JS:
1. create an Element block with JS (element type: post meta template; location: custom; hook name: wp_footer).
2. Create a custom field “image-slider” on the page I want to display the slider on.
3. Add conditional logic to the Element to display it only on pages with the custom field “image-slider”Is it a correct approach? I’m missing something since it doesn’t work properly.
-
Mykola
Abort mission, it actually works. I just added the Element in another block, and it was messing it up.
Also, changed the Element to:
ELEMENT TYPE: hook
HOOK NAME: wp_footerBut if I can get a comment on my logic, please do so 🙂
-
Glad to hear that 🙂 Your approach is correct!
- You must be logged in to reply to this topic.