Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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