dozent_post_type_icon( int|object|null $post = null, bool $echo = true )

Post Type Icon generating function


Description

This function generate icon HTML based on post type, currently dozent_lecture, dozent_quiz, dozent_assignment post types supported.


Parameters

$post

(int|object|null) (Optional) post id, or post object

Default value: null

$echo

(bool) (Optional) Should echo this function itself, or return

Default value: true


Return

(mixed|void)


Source

File: includes/template-functions.php

	function dozent_post_type_icon( $post = null, $echo = true ) {
		$post = get_post( $post );

		$icon = '';
		if ( $post ) {
			$icon = str_replace( 'dozent_', '', $post->post_type );

			if ( $icon === 'lecture' ){
			    $has_video = dozent_has_video( $post );
			    if ( $has_video ){
				    $icon = 'play2';
                }
            }

			$icon      = "<i class='dicon-{$icon}'></i>";
		}

		/**
		 * Filter icon returns by dozent_post_type_icon();
		 *
		 * @since DozentLMS 1.0.0
		 *
		 * @param  string  $icon  HTML generated icon
		 * @param  int|object  $post  Current Post ID or Object
		 */

		$output = apply_filters( 'dozent_post_type_icon', $icon, $post );

		if ( $echo ) {
			echo $output;
		}

		return $output;
	}


Changelog

Changelog
Version Description
DozentLMS 1.0.0 Introduced.