dozent_get_course_categories_dropdown( int $post_ID, array $args = array() )

Get DozentLMS categories in dropdown


Description

See also


Parameters

$post_ID

(int) (Required) Course ID

$args

(array) (Optional) arguments

Default value: array()


Return

(string)


Source

File: includes/template-functions.php

	function dozent_get_course_categories_dropdown( $post_ID = 0, $args = [] ) {

		$defaults = apply_filters( 'dozent_get_course_categories_dropdown_default_args', [
			'classes'  => '',
			'name'     => 'tax_input[course_category]',
			'multiple' => true,
		] );

		$r = wp_parse_args( $args, $defaults );
		extract( $r, EXTR_SKIP );

		$multiple_select = '';

		if ( dozent_array_get( 'multiple', $defaults ) ) {
			$name            = $name . '[]';
			$multiple_select = "multiple='multiple'";
		}

		$classes = (array) $classes;
		$classes = implode( ' ', $classes );

		$categories = dozent_get_all_course_categories();

		$output = '';
		$output .= "<select name='{$name}' {$multiple_select} class='{$classes}' data-placeholder='"
		           . __( 'Search Category', 'dozent' ) . "'>";
		$output .= "<option value=''>" . __( 'Select a category', 'dozent' ) . "</option>";
		$output .= _generate_categories_dropdown_option( $categories, $post_ID );
		$output .= "</select>";

		return $output;
	}


Changelog

Changelog
Version Description
DozentLMS 1.0.0 Introduced.