• Resolved avinashk30

    (@avinashk30)


    Hi,

    I’m using the top bar functionality to display a link to a page unlike others who display announcement, discounts etc. I have searched through the forums and noticed that once you close the top bar, there is no way of bringing it back. I would like to know if there is any way possible to bring the top bar back upon refresh. As I said, I’m using the top bar to give the user an option to visit a page, not announcements.

    Thanks ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author wpexplorer

    (@wpexplorer)

    Hi,

    The close button uses localStorage so once closed it won’t be visible until the user clears their browser cache.

    I don’t understand why you would want the top bar to be visible if the user has closed it, they won’t want to see it. So you will just be forcing the customer to close it every single time they visit your site which is annoying. No?

    That said, because I use localStorage the notice is always in the source code. When closed it’s just hidden with CSS. You could add some custom javascript to your site that removes the “easy-notification-bar–hidden” class on page load.

    For example:

    add_action( 'wp_body_open', function() {
    	?>
    	<script>
    	const noticeEl = document.querySelector( '.easy-notification-bar' );
    	if ( noticeEl ) {
    		noticeEl.classList.remove( 'easy-notification-bar--hidden' );
    	}
    	</script>
    	<?php
    }, 100 );

    This code would be added in your child theme functions.php file or via a code snippet plugin.

    • AJ
    Thread Starter avinashk30

    (@avinashk30)

    Thank you very much. It works.

    What you are saying makes a lot of sense. Unfortunately, it’s a client requirement to have it open in pages even after they close it upon refresh. It’s stupid. I agree.

    This is the website I’m using the bar in: https://orbis.pixoverstudios.com/

    As you can see, its a link to the careers page.

    Your code works. Thank you very much.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Top Bar Closing’ is closed to new replies.