dozent_has_video( WP_Post|int|null $post = null, string|null $key = null )
Determine if a post (course | lecture) containing video
Description
Example usage:
if( dozent_has_video() ) { };
See also
Parameters
- $post
-
(WP_Post|int|null) (Optional) Course or lecture ID | Object
Default value: null
- $key
-
(string|null) (Optional) Video Property
Default value: null
Return
(mixed|void)
Source
File: includes/course-functions.php
function dozent_has_video( $post = null, $key = null ) { $post = get_post( $post ); $video = dozent_get_video( $post->ID ); $video_source = dozent_array_get( 'source', $video ); if ( $video_source && $video_source !== '-1' ) { if ( $key ) { $property_value = dozent_array_get( $key, $video ); /** * Filter default return value by video property * * @see dozent_has_video(); * * @since DozentLMS 1.0.0 * * @param mixed $property_value Value of video info * @param array $video Video info in array * @param string $key Video Property Key */ return apply_filters( 'dozent_has_video_property', $property_value, $video, $key ); } /** * Filter default return value * * @see dozent_has_video(); * * @since DozentLMS 1.0.0 * * @param array $video Video Info if exists * @param WP_Post $post Post Object */ return apply_filters( 'dozent_has_video', $video, $post ); } /** * Filter default return value * * @see dozent_has_video(); * * @since DozentLMS 1.0.0 * * @param bool false False * @param WP_Post $post Post Object */ return apply_filters( 'dozent_has_video', false, $post ); }
Changelog
Version | Description |
---|---|
DozentLMS 1.0.0 | Introduced. |