Skip to content

Instantly share code, notes, and snippets.

@scottopolis
Last active January 10, 2021 19:02
Show Gist options
  • Save scottopolis/79348167e696ea621292e2cd24c3d678 to your computer and use it in GitHub Desktop.
Save scottopolis/79348167e696ea621292e2cd24c3d678 to your computer and use it in GitHub Desktop.
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