I’ve been using Sparkling theme for more than 2 years and I’m extremely pleased by it.
I’m using the Slider to display banners and for my site case the optimal way to display the posts in the slider would be in random order.
For some time I’ve been thinking how to do that (I’m not a programmer, I just know some basic html and css), initially I wanted to use a plugin to randomize posts in specific category, I found one or two but I was not pleased on the way it worked, (the ones I found change the posts date to a random date)
Today I’ve been able to find a much easier solution and wanted to share with the community, not sure if it was discussed already, I’ve searched on Sparkling forum but I didn’t find something similar
So what worked for me I edited extras.php and added
'orderby' => 'rand' to this line from slider function:
$query = new WP_Query( array( 'cat' =>$slidecat,'posts_per_page' =>$count ) );
This line looks like this now:
$query = new WP_Query( array( 'cat' =>$slidecat,'posts_per_page' =>$count,'orderby' => 'rand' ) );
It works like a charm… I know that is not a big thing for a coder, but for me was wow :)) so simple and easy after loosing many hours searching for plugins and testing it…
I also have 2 suggestions for Colorlib team:
- I think an option directly in Sparkling Theme Slider Options to select the way user wants the posts to be ordered will be a good addition to this wonderful theme (something as in the image I attached)
- There might be people (including me) who would like to support more the Colorlib Team, with donations for example, I wasn’t able to find a way to donate, maybe a paypal donation option for Colorlib main site would be welcomed.
Thank you and keep up with the great work. Best regards, John