BugFix: Alert Button is always hidden
-
Thankyou for an excellent and useful plugin.
I have found that the Alert Button does not work. This appears to be due to a bug in functions.php.
In the function get_alertbutton(), an inline stylesheet is generated as follows:
<style> .zhours_alertbutton { color: <?= $color; ?>; background-color: <?= $bg_color; ?>; <?php if ($hide && get_current_status()) { ?> display: none; <?php } ?> display: none; padding: <?= $size; ?>px; font-size: <?= $size; ?>px; line-height: 1; } </style>
Note that
display:none
is always specified. It is specified twice if the if ($hide && get_current_status()) condition is met.
I believe the seconddisplay:none
is erroneous and should be removed, so that the button is only hidden when the condition is met. I have done this on my local install and it works.There again, I’m not sure why the plugin generates the button in a hidden state in that case, when it could just not bother to generate it at all… I can’t think of any situation where I might want the Alert Button to start in a hidden state and then appear sometime after the page has loaded.
I also suggest removing the line-height. It seems unnecessary, and plugins should only set absolutely necessary CSS in inline/enbedded styles, to avoid trampling over the theme’s CSS and requiring the addition of !important overrides to restore it.
Thanks again.
- The topic ‘BugFix: Alert Button is always hidden’ is closed to new replies.