Last active
October 4, 2016 00:04
-
-
Save thomasplevy/8f9936546e81c3ac9c2f8ac360fc58af to your computer and use it in GitHub Desktop.
"Fix" LifterLMS No Access Template when Divi is the theme
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 // don't include this if pasting into a php file | |
/** | |
* Add Divi Related HTML to LifterLMS templates that need some extra elements | |
* | |
* Tested up to Divi v3.0.9 | |
*/ | |
/** | |
* Remove default LifterLMS Content Wrappers | |
*/ | |
remove_action( 'lifterlms_before_main_content', 'lifterlms_output_content_wrapper', 10 ); | |
remove_action( 'lifterlms_after_main_content', 'lifterlms_output_content_wrapper_end', 10 ); | |
/** | |
* Before Content | |
* @return void | |
*/ | |
function my_llms_before_content() { | |
echo ' | |
<div id="main-content"> | |
<div class="container"> | |
<div id="content-area" class="clearfix"> | |
<div id="left-area"> | |
'; | |
} | |
add_action( 'lifterlms_before_main_content', 'my_llms_before_content' ); | |
/** | |
* After content | |
* @return void | |
*/ | |
function my_llms_after_content() { | |
echo ' | |
</div> <!-- #left-area --> | |
'; | |
get_sidebar(); | |
echo ' | |
</div> <!-- #content-area --> | |
</div> <!-- .container --> | |
</div> <!-- #main-content --> | |
'; | |
} | |
add_action( 'lifterlms_after_main_content', 'my_llms_after_content' ); |
If you need support please open a support ticket at https://lifterlms.com/my-account/my-tickets.
Thanks,
This didn't work on my website, as I hide the sidebar by default and then add it manually to the related Divi Page in the Divi Editor. I created a "lifterlms" folder in the root of my Child theme, and then I created a file named "content-no-access.php". I've included my code below:
<?php
/**
* The Template for displaying all single courses.
*
* @author codeBOX
* @package lifterLMS/Templates
*
*/
if ( ! defined( 'ABSPATH' ) ) { exit; }
global $post;
do_action( 'lifterlms_before_main_content' );
?>
<div id="main-content">
<div class="container">
<div id="content-area" class="clearfix">
<div id="left-area">
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="llms-summary entry-content">
<?php llms_print_notices(); ?>
<?php
do_action( 'before_lifterlms_no_access_main_content' );
do_action( 'lifterlms_no_access_main_content' );
do_action( 'after_lifterlms_no_access_main_content' );
?>
</div>
</div>
</div> <!-- #left-area -->
<?php get_sidebar(); ?>
</div> <!-- #content-area -->
</div> <!-- .container -->
</div> <!-- #main-content -->
<?php do_action( 'lifterlms_after_main_content' ); ?>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, Thomas. I went into my functions.php file in Divi, but I'm not sure where to drop this code. There are several return voids. Do you mind helping me out? Also is the "Add Divi Related HTML to LifterLMS templates that need some extra elements" absolutely necessary for everything to work or will the code above fix things?