WordPress.org

Ready to get started?Download WordPress

Forums

Promotion Slider
Slider in widget - random not working (9 posts)

  1. StevieG
    Member
    Posted 2 years ago #

    i am using the slider in a text widget and coded the following

    [promoslider width="100%" height="100%" category="rooms" numberposts="1" start_on="random"]

    The Slider options are also set to random but the display is always the first promotion; I've tested this by changing the sequence. Even more bizarrely, its the first promotion in just that category that gets displayed i.e. if I make a promotion the most recent and its in more than one category it doesn't get displayed!

    Is there something strange happening because its just one promotion being selected?

    http://wordpress.org/extend/plugins/promotion-slider/

  2. Micah Wood
    Member
    Plugin Author

    Posted 2 years ago #

    How many promotions are in your 'rooms' category?

  3. StevieG
    Member
    Posted 2 years ago #

    There are three; one of which is in another category too.

  4. Micah Wood
    Member
    Plugin Author

    Posted 2 years ago #

    Do you mind posting a link to where your slider is? I would like to take a look.

  5. StevieG
    Member
    Posted 2 years ago #

    http://www.threeshoesdorset.co.uk

    The main slider works fine and has promotions in home-promo, food,rooms,about and dorset categories.

    The widgets in the footer are food,rooms and dorset respectively. All are set to display just one promotion as in my initial post.

    Cheers

  6. Micah Wood
    Member
    Plugin Author

    Posted 2 years ago #

    Ah... I didn't catch that the first go round. You are limiting the results to one.

    So here is what is happening:

    1) The numberposts attribute ensures that only one result is returned.
    2) The start_on attribute being set to random ensures that a random image is displayed from the results that are returned.

    So basically you are selecting a single post and trying to randomize it. It is doing exactly what you are telling it to do, it just isn't what you are expecting. You will actually need to adjust the query itself to be random so that you get a different single image every time.

    Take a look at the FAQ and do a search for the promoslider_query_by_id filter. That is the filter you would use to customize the query.

  7. StevieG
    Member
    Posted 2 years ago #

    Thanks Micah
    I hear what you say and have looked at the filter. I can't say I understand exactly how to use it though:-)

    Will I be able to do this from within a text widget?

  8. Micah Wood
    Member
    Plugin Author

    Posted 2 years ago #

    Unfortunately, there is no easy way to implement what you want without touching some code. I wasn't thinking about this particular use case when I created the plugin, so I will be sure to address this in the upcoming release. In the future, you will be able to do this with the shortcode.

    If you want to mess with some code to get it working, just let me know and I can walk you through it.

  9. StevieG
    Member
    Posted 2 years ago #

    Never mind. It's such a great plugin.

    I am sure a solution will present itself:-)

    Thanks again for looking into this for me.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic