Last active
January 10, 2021 19:02
-
-
Save scottopolis/79348167e696ea621292e2cd24c3d678 to your computer and use it in GitHub Desktop.
Custom LearnDash Content for AppPresser
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Add custom content (such as a video) before the LearnDash content | |
* This example adds a video from BuddyBoss to the app | |
* Add this code to a plugin, change the post meta value as necessary | |
*/ | |
add_filter("learndash_content", function($content, $post) { | |
if( class_exists('AppPresser') && AppPresser::is_app() ) { | |
// get our video url from post meta | |
$meta = get_post_meta( $post->ID, '_boss_edu_post_video', 1 ); | |
if( $meta ) { | |
// if the video url exists, add the embed code before the LearnDash content | |
$content = wp_oembed_get( $meta ) . $content; | |
} | |
} | |
return $content; | |
}, 5, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment