Hide Bullets if only one slide?

if's Avatar


06 Nov, 2017 10:44 PM

Is there a way to hide the navigation bullets if there is only one slide?

I realize I could just show an image instead... but I'm using a custom template that calls a specific "RoyalSlider" number, and it would be ideal if I could modify the slider code to only show the bullets if there's more than one slide.

Example of a page with only one slide - http://www.lunar.com/work/oralb/

Any suggestions?

  1. Support Staff 1 Posted by Dmitry Semenov on 07 Nov, 2017 07:08 AM

    Dmitry Semenov's Avatar


    You can do something like this:

    function rs_hide_navigation_for_one_slide() {
        $('.royalSlider').each(function() {
            var sliderInstance = $(this).data('royalSlider');
            if(sliderInstance.numSlides === 1) {
    add_action('new_rs_after_js_init_code', 'rs_hide_navigation_for_one_slide');


    But ideally, of course, you should use slider only if there is more that one image.


  2. 2 Posted by if on 08 Nov, 2017 02:00 AM

    if's Avatar

    Thank you so much for this - worked like a charm!!

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac