Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

Packages Shortcode

// Add Shortcode
function generate_package_list_shortcode( $atts , $content = null ) {

	// Attributes
	$atts = shortcode_atts(
		array(
			'package_types' => '',
			'number' => '',
			'sort' => '',
		),
		$atts,
		'package_list'
	);

	// WP_Query arguments
	$args = array(
		'post_type'              => array( 'hostingpackage' ),
		'post_status'            => array( 'publish' ),
		'nopaging'               => false,
		'posts_per_page'         => '20',
	);
	
	// The Query
	$query = new WP_Query( $args );
	
	// The Loop
	if ( $query->have_posts() ) {
		while ( $query->have_posts() ) {
			$query->the_post();
			// do something
		}
	} else {
		return "<p>No packages found</p>";
	}
	
	// Restore original Post Data
	wp_reset_postdata();

}
add_shortcode( 'package_list', 'generate_package_list_shortcode' );