Skip to content

Instantly share code, notes, and snippets.

@billerickson
Last active Jul 17, 2018
Embed
What would you like to do?
<?php
/**
* Featured Posts
* Display 5 posts from the "featured posts" category, published in the
* last 2 weeks, sorted by share count
*/
function ea_featured_posts() {
$loop = new WP_Query( array(
'posts_per_page' => 5,
'category_name' => 'featured-posts',
'orderby' => 'meta_value_num',
'meta_key' => 'shared_counts_total',
'order' => 'DESC',
'date_query' => array( array( 'after' => '2 weeks ago' ) )
) );
// ...
}
add_action( 'genesis_before_loop', 'ea_featured_posts' );
// Build the page
genesis();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment