Skip to content

Instantly share code, notes, and snippets.

@MrVibe
Created February 7, 2020 16:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MrVibe/5e3627782208ce68eb7664c6c4a2fb52 to your computer and use it in GitHub Desktop.
Save MrVibe/5e3627782208ce68eb7664c6c4a2fb52 to your computer and use it in GitHub Desktop.
Add a HelloBar like notification in WPLMS
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