Skip to content

Sliders ​

Sliders, compatible with Slide Anything data.

kitloom/slider · admins: kitloom/slider-filament, kitloom/slider-nova

Slide Anything plugin sliders working directly on WordPress data: the sa_slider post type, slides and settings in post meta — in the same place and format the plugin stores them — and the [slide-anything] shortcode. Admin panels: kitloom/slider-filament and kitloom/slider-nova.

Where the data lives ​

In the slider post's wp_postmeta:

  • sa_num_slides — the number of slides;
  • sa_slide{N}_content, sa_slide{N}_link_url, sa_slide{N}_image_data and the other slide fields, N starting at one;
  • sa_slide_duration, sa_items_width1…6, sa_css_id and the other settings — one key per setting.

The package has no tables or migrations of its own.

What's inside ​

ElementPurpose
SlideAnythingThe post type, the shortcode and the model key in the registry.
SliderMetaThe plugin's meta keys, defaults for a new slider and a new slide.
SliderSlidesReads and writes slides and settings in meta.
Data\Slide, Data\SlideBackgroundOne slide with all its fields; the slide background.
Data\SliderOptionsSettings, read the way the plugin's front end reads them.
SliderPayloadThe slider for the front end: slides in order and carousel settings.
SlidersBeingDrawnThe sliders the request is drawing: a slider whose slide names it again is not drawn inside itself.
Concerns\HasSlidesSlides on a post. A trait, since the application's post already extends its own model.
Models\SliderDefault for installations without their own post model.
SlideAnythingShortcode[slide-anything id='12'] and [slide-anything slug='header'].
resources/js/SlideAnything.vueA Glide carousel driven by the slider settings; the theme gets it from the build.

Writing slides ​

php
app(SliderSlides::class)->put($slider, [
    ['position' => 2],                                   // second slide becomes first
    ['position' => 1, 'fields' => ['content' => '…']],   // first becomes second, with new text
    ['fields' => ['content' => '<p>New</p>']],           // new slide
]);

A slide with position moves with all its fields — including those not edited here (the plugin's popups). A new post has no id yet: $slider->queueSlides([...]) writes the slides once the post is saved.

fillMissingSettings() adds the settings the slider lacks, using the plugin's defaults: the plugin's front end reads them without checking, and without them WordPress won't display the slider.

What the front end gets ​

The shortcode puts slider into the page data — SliderPayload::toArray(): slides (content, link_url, link_target, background) and options — how many slides are visible at which screen width, autoplay, loop, arrows, dots, styles.

  • Reverse order is applied here, random order is not: pages are cached, so the browser has to shuffle (options.random_order).
  • Shortcodes in slides are processed only if enabled for the slider (sa_shortcodes), as in the plugin.
  • Slide images are lazy-loaded — except those with loading set manually.

The slider is drawn by the theme, like any shortcode: a Vue theme in place of the anchor, from the data whose shortcode is slide-anything; a Blade theme with its shortcodes/slide-anything view. Nothing puts a component into a theme by itself: the site's Vite build reads only the theme's own files.

resources/js/SlideAnything.vue is a ready carousel for a Vue theme to import from the package and give the slider prop, or to copy and change. It imports nothing from a theme and uses no theme classes — its styles are its own, scoped — so it builds in any of them; the carousel is Glide, and @glidejs/glide is an application dependency (the skeletons have it).

A slide's HTML is drawn as it is. Shortcodes inside a slide leave their anchors in that HTML and their data in the page's shortcodes, like any other; a theme that draws them passes its own renderer in the content slot:

vue
<SlideAnything :slider="data.slider">
    <template #content="{ html }">
        <RichContent :html="html" :shortcodes="shortcodes" />
    </template>
</SlideAnything>

The plugin's slide transition effects (Fade, Zoom…), showcase, thumbnails and popups are not rendered — their meta stays and moves along with the slide.

The shortcode is turned off with kitloom-slider.shortcodes.register, the admin sections with kitloom-slider.filament.register and kitloom-slider.nova.register.

Tests ​

The tests run in the skeletons, in the Slider testsuite: the package's own (slider/tests) in both, the Nova admin's (slider-nova/tests) in kitloom-cms-skeleton-site.

AI agents ​

With kitloom/ai installed, an agent lists the sliders with their shortcodes (sliders_list), reads one with its slides (slider_get) — the published ones, and drafts only for a user who sees them — and — when its user has manage_sliders — creates a slider or replaces its slides (slider_save): content, link, target and background image per slide (an attachment of the media library), an existing slide keeping its other fields by its position. A slider made this way gets the plugin's default settings, so WordPress shows it too. kitloom-slider.ai.register false — no slider tools.

kitloom — modules and themes for Laravel.
Pricing · Services · License · Refunds · Privacy · Community · [email protected]