Skip to content

Release v1.0.2 - slider latte component now supports custom WP_Queries

Compare
Choose a tag to compare
@nikola-wd nikola-wd released this 18 Sep 18:21
· 15 commits to main since this release

Added support for the _slider.latte component to accept an instance of the WP_Query as the alternative to the array.

Note that when using the slider component with the WP_Query, the "slide_q" block is used as opposed to the "slide" block, which is used with regular arrays

Added the "after_loop" block as well, which can be used to insert the pagination, for example.

Can be used like this for example:

{var $posts_query = new WP_Query(
  array(
    'post_type' => 'post',
    'posts_per_page' => 6,
    'orderby' => 'DESC',
  )
)}

{embed 
  tr_part('_slider'), 
  class: 'slider--test', 
  slides: $posts_query
}
  {block slide_q}
    <div style="box-shadow: 0 0 0 1px blue">
      <h5>{the_title()}</h5>
    </div>
  {/block}

  {block after_loop}
    <div style="padding: 10px; box-shadow: 0 0 0 1px orange;">
      <strong>pagination can be added here</strong>
    </div>
  {/block}
{/embed}