Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Custom LearnDash Content for AppPresser
<?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