functions.php文章添加以下代码,博客模块css: random-posts
function dd_random_posts($query, $args) {
if (isset($args[‘module_id’]) && $args[‘module_id’] === ‘random-posts’) {
$query->query_vars[‘orderby’] = ‘rand’;
$query->query_vars[‘order’] = ‘ASC’;
$query = new WP_Query( $query->query_vars );
}
return $query;
}
add_filter(‘et_builder_blog_query’, ‘dd_random_posts’, 10, 2);
国外教程:https://dondivi.com/divi-blog-module-how-to-order-randomly/