0

I have block with image so the easy way it's to create a content type. I have node--nodeName.tpl.php where I built correct DOM.

But this is slider, and all nodes embedded in one div with classes

block-system-main block block-system

I have to initialize slider. For this I need unique parent class\id

enter image description here This is beginning of my node--nodeName.tpl:

<div class="<?php print $classes . ' slick_hero ' . ' ' . $zebra; ?>">

1 Answer 1

0

Looks like you're having a block of node teasers, and you want to initialize a slick slider on its items using vanilla JS, yes? There's a better way to do this, and that's to use the Slick module together with Slick Views.

  1. Create a slick carousel view, configure it as a block and not a page.
  2. Filter to the desired nodes
  3. Configure to render the teaser displays
  4. Configure the slider parameters.
  5. On whatever block rendering mechanism you have (Block Layout, Context, Panels, whatever), position the view in the desired location.

All that and you never have to touch code or meddle with the template.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.