Boost Your Quiz Engagement with a Dynamic ‘Quiz Results’ Tab

Simplify your quiz process with the ‘Last Quiz’ shortcode. Seamlessly integrated with the Quiz Notifications Plugin!This snippet is a time-saving solution for easily displaying quiz results in courses, lessons, and topic pages.

What is a Content Tab?

A content tab, or simply a ‘tab’, is an additional panel of information that appears when you click on something related in your course. This could include notes about the lesson topic or helpful tools and links for students.

LearnDash’s ‘Learn Dash Content Tabs Filter’ snippet makes it easy to add these extra resources to your course. Instead of using the materials tab in your course settings, you can use code to dynamically add content tabs. With just a few small adjustments, you can customize the code to fit your needs and streamline the process.

Enhance your quizzes with the ‘Quiz Results’ tab using the modified code below. This snippet, designed for use with the ‘Quiz Notifications for LearnDash Plugin‘, will insert the [[elc_last_quiz …]] shortcode into every course, lesson, topic, and quiz page, providing an easy way to access quiz results.

When can you expect to see the ‘Quiz Results’ tab displayed?

  1. After successfully completing a quiz, proceed to the next step and return later to find the ‘Quiz Results’ tab now visible.

How to use the code?

  • Insert the following code in your themes custom functions.php file or use a plugin called “Code snippets”.
  • A basic knowledge of PHP is required to modify the code.
 * Example usage for learndash_content_tabs filter.
 * @SEE:
 * This snippet will add the tab with Last Quiz shortcode output on all: course, lesson, topic pages,
 * provided there are quiz results. 
	function ( $tabs = array(), $context = '', $course_id = 0, $user_id = 0 ) {

		// Add optional logic to show the custom tab only on certain courses.
//		if( 123 !== $course_id ) {
//			return $tabs;
//		}

		// Check if Quiz Notifications for LearnDash plugin is actived.
		if( ! function_exists( 'elc_ldquiz_last_quiz_callback' ) ){
			return $tabs;

		// List of content types to show the Tab and the Last Quiz. 
		// You can comment or uncomment content types for which the tab will be shown. 
		// Below will show the tab on lesson and topic pages only. 
		$elc_context = array(
//			'course',
		//	'quiz',

		// If this is a post type we want to show Last Quiz, test if there is quiz results to render.
		if( in_array( $context, $elc_context ) ) {
			// Test for timespent only.
			$shortcode_atts = array(
				'show' => "timespent",
			$elc_test = elc_ldquiz_last_quiz_callback( $shortcode_atts );

		// Add our Custom Last Quiz Tab.
		if( ! empty( $elc_test ) && ! isset( $tabs[ 'lastquiz' ] ) ) {
			// show attribute values.
			// The quiz results will be printed in the order as in array.
			$show_ar = array(

			// Last Quiz shortcode attributes.
			// Default values for parameters: 
			// 			'collapsible'     => false,
			// 			'show_essay'      => false,
			// 			'comments'        => false,
			// 			'show_correct'    => true,
			// 			'show_points'     => true,
			// 			'answer_feedback' => false,
			// 			'question_cat'    => false,
			// 			'breadcrumbs'     => false,
			// 			'print_button'    => false,
			$shortcode_atts = array(
				'show' => implode( ',', $show_ar ),
				'answer_feedback' => true,
				'show_points' => false,

			// Get the HTML Last Quiz results.
			$elc_content = elc_ldquiz_last_quiz_callback( $shortcode_atts );

			// For print button uncomment line below.
			$elc_content = elc_ldquiz_print_callback( '', $elc_content );

			$tabs[ 'lastquiz' ] = array(
				'id'      => 'lastquiz',
				// The value here is to a CSS class you control to show an icon.
				'icon'    => 'ld-downloads-icon',
				'label'   => 'Quiz Results',
				'content' => $elc_content,

		// Always return $tabs.
		return $tabs;
Scroll to Top