esc_attr__( 'Random Posts', 'arpw' ), 'title_url' => '', 'offset' => 0, 'limit' => 5, 'orderby' => 'rand', 'post_type' => 'post', 'post_status' => 'publish', 'ignore_sticky' => 1, 'taxonomy' => '', 'thumbnail' => false, 'thumbnail_size' => 'arpw-thumbnail', 'thumbnail_align' => 'left', 'excerpt' => false, 'excerpt_length' => 10, 'date' => false, 'css_class' => '', 'before' => '', 'after' => '' ); // Allow plugins/themes developer to filter the default arguments. return apply_filters( 'arpw_default_args', $defaults ); } /** * Outputs the random posts. * * @since 0.0.1 */ function arpw_random_posts( $args = array() ) { echo arpw_get_random_posts( $args ); } /** * Generates the random posts markup. * * @since 0.0.1 * @param array $args * @return string|array The HTML for the random posts. */ function arpw_get_random_posts( $args = array() ) { // Set up a default, empty $html variable. $html = ''; // Get the default arguments. $defaults = arpw_get_default_args(); // Merge the input arguments and the defaults. $args = wp_parse_args( $args, $defaults ); // Extract the array to allow easy use of variables. extract( $args ); // Allow devs to hook in stuff before the loop. do_action( 'arpw_before_loop' ); // Get the posts query. $posts = arpw_get_posts( $args ); if ( $posts->have_posts() ) : $html = '