Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Feuer Karten Shortcode Boilerplate

// Add Shortcode
function lk_shortcode_function() {

	// WP_Query arguments
	$args = array(
		'post_type'              => array( 'lichtkarte' ),
		'nopaging'               => true,
		'orderby'                => 'rand',
		'meta_query'             => array(
			array(
				'key'     => 'card_element',
				'value'   => 'Feuer',
				'compare' => '=',
				'type'    => 'CHAR',
			),
		),
	);
	
	// The Query
	$fire_main_query = new WP_Query( $args );
	
	// The Loop
	if ( $fire_main_query->have_posts() ) {
		while ( $fire_main_query->have_posts() ) {
			$fire_main_query->the_post();
			// do something
		}
	} else {
		// no posts found
	}
	
	// Restore original Post Data
	wp_reset_postdata();

}
add_shortcode( 'lichkarten', 'lk_shortcode_function' );