| 开发者 | studioleokawa |
|---|---|
| 更新时间 | 2026年9月30日 21:41 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
var(--primary).wp_body_open hook. For older themes without that hook, the bar is moved to the top of the page automatically.[definitive_announcement_bar] shortcode wherever you want the bar.Yes. When Bricks is your active theme, the bar is printed right before the Bricks header template. If you would rather place it inside your header, choose "Manual" placement and add the [definitive_announcement_bar] shortcode with a Bricks Shortcode element.
Yes. WooCommerce pages get their own display rules, so you can, for example, hide the bar on the checkout. You can also hide it on individual products.
When the bar is visible, its height is available as the CSS variable --dabar-height on the html element. Add top: var(--dabar-height, 0px); to your sticky header. The variable is set to 0px once a visitor closes the bar.
Sticky positioning is blocked when a parent element uses overflow: hidden. Check your theme or custom CSS for overflow on html, body or wrapper elements.
With "Keep closed for" set to 0, the bar comes back in the next browser session. Otherwise it stays closed for the number of days you choose. Changing the messages always shows the bar again to everyone.
Use the dabar_should_display filter:
add_filter( 'dabar_should_display', function ( $display ) { return is_page( 'contact' ) ? false : $display; } );
Yes. The bar uses the ID #dabar and the classes .dabar__inner, .dabar__content, .dabar__message, .dabar__button and .dabar__close. The colors and sizes are CSS custom properties (--dabar-bg, --dabar-color, --dabar-close-color, --dabar-link-color, --dabar-button-bg, --dabar-button-color, --dabar-font-family, --dabar-font-size, --dabar-min-height, --dabar-padding), so you can override them in your stylesheet.