Created
February 7, 2020 16:58
-
-
Save MrVibe/5e3627782208ce68eb7664c6c4a2fb52 to your computer and use it in GitHub Desktop.
Add a HelloBar like notification in WPLMS
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
add_filter('vibe_option_custom_sections',function($sections){ | |
$sections[1]['fields'][]= array( | |
'id' => 'header_notification', | |
'type' => 'editor', | |
'title' => __('Header Notification', 'vibe'), | |
'sub_desc' => __('* Standard headers', 'vibe'), | |
'desc' => __('Add header notification', 'vibe'), | |
'std' => '' | |
); | |
return $sections; | |
}); | |
add_action('get_template_part',function($slug, $name){ | |
if($slug == 'mobile' && $name == 'sidebar'){ | |
$header_notification = vibe_get_option('header_notification'); | |
if($header_notification){ | |
echo '<div class="wplms_header_notification"><div class="wplms_header_notification_content">'; | |
echo do_shortcode($header_notification); | |
echo '</div><span class="fa fa-times"></span></div>'; | |
add_action('wp_footer',function(){ | |
?> | |
<style>.wplms_header_notification{display:flex;justify-content:space-between;align-items:center;padding:10px;width:100%;background:#F25F1E; color:#fff;}</style> | |
<script>jQuery(document).ready(function($){ | |
$('.wplms_header_notification .fa-times').on('click',function(){$('.wplms_header_notification').hide(200);}); | |
});</script> | |
<?php | |
}); | |
} | |
} | |
},10,2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment