Using the Karma Theme for a community portal.
Have a full width slider and below that a four column layout which pulls posts from a partcular category.
By default, the latest four posts get pulled.
However, the older posts get ignored by new visitors.
I would therefore like to pull posts from any category(ies) using the RAND command or any other code so that any four RANDOM posts are pulled.
In addition I would like a button at the bottom of the four columns which, when clicked, would REFRESH the four posts above with a fresh set of four random posts.
Look forward to your solution. Thanks.
Arnav Joy answers:
are you talking about the home page slider?
Arnav Joy comments:
open these two files
and find following line:-
replace it with
you have to add "&orderby=rand" at last to show posts randomly
and if you want to use any category then you have to remove "cat " parameter from the above query string ,so your final string will be like
if you are using child theme then you should apply these changes to child theme not to karma otherwise your changes will be lost when you will upgrade it.
let me know if you have any problem doing it.
Daniel Yoen answers:
also, you can try edit "theme-template-part-content-blog.php" file
add this line :
query_posts(array("orderby" => "rand"));
if (have_posts()) : while (have_posts()) : the_post();
hope this help :-)