Okay
  Public Ticket #448046
Randomized order for Home Page Slider
Closed

Comments

  • Clint started the conversation

    Is there a way to randomize the order of items set to appear in the Home Page slider?

    This would be a fantastic feature to include in a future PowerMag theme upgrade, but I'd love to understand how to adjust it in the present version if possible.

    Any help is much appreciated—I realize this is above and beyond the call.

  •  93
    djwd replied

    Hi there,

    You should edit the slider query in partials/part-sliders.php

    As per the WP Codex, should be enough the edit line 37

    ORDER BY wposts.post_date DESC
    

    with

    ORDER BY wposts.post_date rand
    

    (untested)

    Hope it helps

    Thanks for your feedback about the feature.

    Regards
    djwd

    Regards
    djwd

  •   Clint replied privately
  •  93
    djwd replied

    Hi there,

    try by replacing the whole line with:

    ORDER BY rand()

    Hope it helps

    Regards
    djwd

    Regards
    djwd

  • Clint replied

    That worked! We can close out the ticket. I think that giving a setting to randomize this main carousel might be a great feature for a future update.

    I was also able to pull partials/part-sliders.php into my child theme and modify it there, so it shouldn\'t affect any theme updates (except one that might have that new feature—in which case I\'ll just delete my file.)

    Thanks again!

  •  93
    djwd replied

    Glad it worked! I\'ll consider adding this as an option since it\'s a simple one.

    Thank you for your feedback.

    Regards
    djwd

    Regards
    djwd

  •   Clint replied privately
  •    djwd replied privately