Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

General

How to get lightslider to work

Solved by pamtbaau View solution

Started by yehuda clinton 5 years ago · 2 replies · 1499 views
5 years ago

Could someone help me with lightslider plugin
i tried making a simple text slide by putting lightslider.md in a page directory.
the contents look like this
first slide

TXT
second slide
---
third

but it just show as one without a slide

could someone help me

5 years ago

Hi @yehuda , Welcome to Grav 🙂

I have had a bit of a play and finally got it working , the plugin instructions were a little vague , but to get it working as it was intended in a module page is as follows

install grav , ensure the error, problems and lightslider plugin are installed and enabled.

Download the github resource which will give you a new folder 03.LightSlider and copy it your pages directory.

https://github.com/spamhater-grav/GravCms-Lightslider-Plugin-QuarkDemo

Expand the archive and copy the 03.Lightslider to your pages directory

It shows the layout format to get it working as a module.

Basically a modular page is created and then under that is modular
pages / items including the slider is made as a module underneath.

I have added a bit of text above and below it as the modular directory and used page number rather than _prefixes, so you can change the order through the admin panel.

If you made the modular subpage as non-number prefix you will have to alter the 03.LightSlider page and add your custom order in the frontmatter like

YAML
   order:
        by: default
        dir: asc
        custom:
            - _above
            - _slider
            - _below

and finally the extra line in the 03.LightSlider modular.md
will make sure it show the main site navigation

onpage_menu: false

The demo has been tested with Quark theme, and the above onpage_menu is currently only applicable to that theme (eeK) Ask away if you have any more questions

👍 1
last edited 05/12/21 by Spam Hater
5 years ago Solution

@yehuda, Judging from the way the resulting page looks, it seems you want a regular page containing a slider.

There are two ways to get it done. I'll describe the easy one here:

  • The folder structure should look as follows:
    TXT
    pages
    ├── 01.home
    ├── 02.page-with-slider
    │   └── default.md
    └── slider-content
      └── lightslider.md
    
  • Page '02.page-with-slider/default.md' contains the following:

    TWIG
    ---
    title: Slider
    process:
    twig: true
    ---
    
    {% include 'modular/lightslider.html.twig' with 
    {'page': page.find('/slider-content')} %}
    

    You are free to add any text above and below the {% ... %} snippet.

  • And page '/slider-content/lightslider.md' contains the following:

    YAML
    ---
    title: Slider Content
    routable: false
    visible: false
    lightslider:
    slider_type: text
    ...your-slider-settings
    ---
    
    # Shop Geek Stuff
    ## We have all your **geek** needs covered..
    ---
    # SnipCart Powered
    ## **Grav** plus **SnipCart** equals easy shopping
    ---
    # A Huge Variety
    ## A great selection of **bits** and **bobs**
    

The other option is to include the Twig snippet {% ... %} inside a template. And assign the name of the template to the filename of the page. But for this, you will need to override the theme.

Hope this helps...

👍 2
last edited 05/12/21 by pamtbaau

Suggested topics

Topic Participants Replies Views Activity
General · by Jerry Hunt, 4 days ago
2 95 14 hours ago
General · by pamtbaau, 20 hours ago
1 61 19 hours ago
General · by Andy Miller, 1 day ago
0 47 1 day ago
General · by Marcel, 12 months ago
6 356 5 days ago
General · by Duc , 6 days ago
3 44 6 days ago