# learnpress/trunk/inc/Shortcodes/CourseMaterialShortcode.php

LearnPress – WordPress LMS Plugin for Create and Sell Online Courses, version trunk. 39 lines.

- Page: https://pluginprobe.com/plugins/learnpress/trunk/code/inc/Shortcodes/CourseMaterialShortcode.php
- Raw: https://pluginprobe.com/plugins/learnpress/trunk/raw/inc/Shortcodes/CourseMaterialShortcode.php
- Modified: 2024-08-10T07:01:34+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/learnpress/trunk/code/inc/Shortcodes/CourseMaterialShortcode.php#L10-L20`.

```php
<?php
/**
 * Shortcode display single instructor.
 */
namespace LearnPress\Shortcodes;

use LearnPress\Helpers\Singleton;

class CourseMaterialShortcode extends AbstractShortcode {
	use singleton;
	protected $shortcode_name = 'course_materials';

	/**
	 * Show single instructor
	 *
	 * @param $attrs [instructor_id: int]
	 *
	 * @return string
	 */
	public function render( $attrs ): string {
		$content = '';

		try {
			if ( empty( $attrs ) ) {
				$attrs = [];
			}
			ob_start();
			do_action( 'learn-press/course-material/layout', $attrs );
			$content = ob_get_clean();
		} catch ( \Throwable $e ) {
			ob_end_clean();
			error_log( $e->getMessage() );
		}

		return $content;
	}
}


```
