AAM Flyer
asked 10 years ago

DW Promobar meets my needs except for one thing – it doesn’t auto-hide.  Is there any way of adding that or can it be implemented in the next release?

3 Answers
Wilfred
answered 10 years ago

Hi AAM,
Thanks for pointing on our question & answer site !
Regarding the feature you gave, we will consider to develop it in the upcoming the version of the plugin. To resolve the issue temporarily, please follow our instruction below:
– Open main.js in wp-content/plugins/dw-promobar/assets/js/main.js
– Add following code to line 89

setTimeout(function(){
function remove_promobar() {
$('#dwpb, .dwpb-close, .dwpb-action').remove();
$('body').removeClass('dwpb-cover-page dwpb-ramain-top dwpb-open dwpb-push-page').removeAttr('style');
$('#wpadminbar').removeAttr('style');
}
remove_promobar();

if ( $.cookie('dwpb-close') == 'dwpb-close-' + dwpb.reset_cookie ) {
remove_promobar();
};
if (cookie == undefined) {
$.cookie('dwpb-close', 'dwpb-close-' + dwpb.reset_cookie, {path: '/'} );
}
},5000);

Note: Change 5000 in the code above to your time as you want (1000 = 1s)
Hope this helps!

AAM Flyer
answered 10 years ago

Hi Wilfred,
Thank you for this solution. However, this completely removed the promo bar and I’d like it to just be hidden – as if the user had clicked the hide button. So, I did a bit of work on this and came up with this solution which you might consider putting in your upcoming version:

setTimeout(function() {
    if ( $(‘body’).hasClass(‘dwpb-open’) ) {
        setTimeout(function(){
            if ( $(‘body’).hasClass(‘dwpb-open’) ) {
                $(‘.dwpb-action’).click();
                $.removeCookie(‘dwpb-hide’, {path: ‘/’});
            }
        },7000);
    }
}, 1500);

Cheers!

DominicStaff
answered 10 years ago

Awesome ! Thank you for your solution. We will discuss about this solution and may be put in my update version:

Powered by DW Question & Answer Pro