Community Forums › Forums › Archived Forums › General Discussion › Academy Pro Banner
Tagged: Academy Pro Banner
- This topic has 5 replies, 3 voices, and was last updated 5 years ago by ProfitForSaving.
-
AuthorPosts
-
November 30, 2018 at 2:55 pm #224736Nelson BriggsParticipant
I created a new website at nelsonbriggs.com using the Academy Pro child theme, and I need to be able to set the dismissable banner to give each visitor the option of dismissing it every time they visit the site, but have it pop up again the next time they visit the site. Both giving them the control to "X" it out, and giving me the option to make sure they see it if I am running a promotion or have changed to a new promotion.
http://www.nelsonbriggs.com
Thanks!
NelsonNovember 30, 2018 at 3:33 pm #224737Victor FontModeratorThe top banner in Academy Pro works with cookies. The javascript API that manages the cookies can be found here: https://github.com/js-cookie/js-cookie.
The code supplied with the theme is in the /js/top-banner.js file. The top banner cookie is set to expire after 7 days. You can see this at line 63.
The API allows for changing the expiration. The expiration value Value can be a Number which will be interpreted as days from time of creation or a Date instance. If you omit the expiration, the cookie becomes a session cookie. Session cookies are deleted when the user closes the browser.
Since you want the cookie to expire when the user leaves the site, edit the /js/top-banner.js and remove the expiration parameter.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?December 1, 2018 at 10:45 am #224762Nelson BriggsParticipantHi Victor...
Thank you very much for helping me out with this! It worked, but it seems like it doesn't work with cellphone browsers. Would you be able to share how to make the banner nondismissable?
And, I like your website... Looks like you may have used Academy Pro as well?
Thanks!
Nelson
December 1, 2018 at 1:01 pm #224763Victor FontModeratorI am using Academy Pro, but a highly modified version with CSS Grid and Flex box.
On mobile, you dismiss the banner the same way you do on desktop. You click the X. It may be possible the X is hidden by something on your phone. I'm not using the banner any longer, but when I did, I moved the X to top rather than leave it on the right side to make it more visible. You can adjust its position with CSS.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?March 24, 2019 at 3:33 pm #490241Nelson BriggsParticipantHi Victor... Do you know how to remove the close banner "X" link and the respective jQuery that wouldn't be required if the close link is gone? I have located what I think is the section whare the PHP would be changed, lines 595 - 608...
function academy_do_top_banner() {
if ( get_theme_mod( 'academy-top-banner-visibility', true ) ) {
$button = sprintf( '<button id="academy-top-banner-close"><span class="sp-icon-x"></span><span class="screen-reader-text">%s</span></button>', __( 'Close Top Banner', 'academy-pro' ) );
printf(
'<div class="academy-top-banner">%s%s</div>',
get_theme_mod( 'academy-top-banner-text', academy_get_default_top_banner_text() ),
$button
);}
}
Thanks!
Nelson
March 24, 2019 at 3:46 pm #490242ProfitForSavingMemberI had the exact same problem but did not get it to work, when I had the same problem for some while ago. I think I started using another plugin, which fixed it, but I am not totally sure 🙂
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.