To have Featured Content show random posts, we would need to add an orderby
parameter to the section at line 169 in inc/featured-content.php
, so that it looks like this:
// Query for featured posts.
$featured = get_posts( array(
'numberposts' => $settings['quantity'],
'tax_query' => array(
array(
'field' => 'term_id',
'taxonomy' => 'post_tag',
'terms' => $tag,
),
),
'orderby' => 'rand',
) );
Now, as Kathryn mentioned above, the proper way to make these changes is in a child theme. However, the above changes will not currently work if done in a child theme; we’re fixing that up.
If you want to use the above changes, they’ll need to be done in the Twenty Fourteen theme itself, which means you’ll risk losing those changes when Twenty Fourteen gets updated. If you’re comfortable doing it anyways, you’ll also need to comment out two lines, also in inc/featured-content.php
: lines 154 and 190.
// $featured_ids = get_transient( 'featured_content_ids' );
// set_transient( 'featured_content_ids', $featured_ids );