Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

custom table aggregator

shows values in table format from a custom table

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

	// Attributes
	$atts = shortcode_atts(
		array(
			'ddate' => '',
			'mmonth' => '',
			'llimit' => '',
		),
		$atts
	);

	return '<?php
	global $wpdb;
	$result = $wpdb->get_results( "SELECT year, event FROM wp_wct3 where date= ' . $atts['ddate'] . '  AND month=' . $atts['mmonth'] . ' Limit ' . $atts['llimit'] . '");
	echo "<table><thead><tr><td>Year</td><td>Event</td></tr></thead><tbody>";
	foreach($result as $row)
	 {
	 echo "<tr><td>".$row->year."</td><td>".$row->event."</td></tr>";
	 }
	echo "</tbody></table>";
	?>

}
add_shortcode( 'nevent', 'nevent_shortcode' );