Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Make a reusable image slider

  • 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.

  • 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_footer

    But if I can get a comment on my logic, please do so 🙂

  • Glad to hear that 🙂 Your approach is correct!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.