Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Showing 1 post from featured category

Showing 1 post from featured category

// WP_Query arguments
$args = array (
	'post_type'              => 'post',
	'category_name'          => 'Featured',
	'posts_per_page'         => '1',
	'orderby'                => 'rand',
);

// The Query
$queryn = new WP_Query( $args );

// The Loop
if ( $queryn->have_posts() ) {
	while ( $queryn->have_posts() ) {
		$queryn->the_post();
		// do something
	}
} else {
	// no posts found
}

// Restore original Post Data
wp_reset_postdata();