Skip to content

Instantly share code, notes, and snippets.

@andrewlimaza
Created December 2, 2024 07:44
Show Gist options
  • Save andrewlimaza/676ceff1fcd8d1b492cf89a8419f1ec7 to your computer and use it in GitHub Desktop.
Save andrewlimaza/676ceff1fcd8d1b492cf89a8419f1ec7 to your computer and use it in GitHub Desktop.
Move the content restricted message higher up the course content for LifterLMS
<?php
/**
* Move the Paid Memberships Pro content restricted message higher up in LifterLMS course content.
* This requires "Course Information" block to be on the page and shown before this using jQuery.
* Tweak this jQuery code to fit your needs and move the content higher up.
*
* To add the code to your site you may follow this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_move_pmpro_div_with_jquery_llms() {
?>
<script type="text/javascript">
jQuery(document).ready(function ($) {
if ($('article').hasClass('course')) {
if ($('.entry-title').length && $('.pmpro').length) {
$('.pmpro').insertBefore('.llms-meta-info');
}
}
});
</script>
<?php
}
add_action('wp_footer', 'my_move_pmpro_div_with_jquery_llms');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment