1,
'display_mode' => 'static', // 'static', 'scrolling', 'sliding'
'messages' => array(
'🚀 Flash Sale! Get 25% OFF on all plans with code SAVE25 — Limited time only!',
'⚡ Free Express Shipping on all orders over $50!',
'🎉 New Feature Alert: Check out our latest release today!',
),
'scroll_speed' => 22, // Seconds per marquee cycle.
'slide_interval' => 4, // Seconds between slides.
'slide_direction' => 'vertical', // 'vertical' or 'horizontal'
// Position & Targeting.
'position' => 'top_sticky', // 'top_sticky', 'top_static', 'bottom_sticky'
'target_pages' => 'all', // 'all', 'homepage'
'device_visibility' => 'all', // 'all', 'desktop_only', 'mobile_only'
'dismissible' => 1,
'reappear_days' => 0, // 0 = Show again on page refresh (default).
// CTA Button.
'cta_enabled' => 1,
'cta_text' => 'Shop Now',
'cta_url' => '#offer',
'cta_new_tab' => 0,
'cta_bg_color' => '#ffffff',
'cta_text_color' => '#1e1b4b',
'cta_border_radius' => 20,
// Countdown Timer.
'countdown_enabled' => 0,
'countdown_end' => gmdate( 'Y-m-d\TH:i', strtotime( '+3 days' ) ),
'countdown_label' => 'Ends in:',
// Design & Typography.
'bg_type' => 'gradient', // 'solid', 'gradient'
'bg_color' => '#1e1b4b',
'bg_gradient_end' => '#4338ca',
'bg_gradient_angle' => 90,
'text_color' => '#ffffff',
'font_size_desktop' => 14,
'font_size_mobile' => 12,
'font_weight' => '500',
'bar_padding_desktop' => 10,
'bar_padding_mobile' => 8,
);
}
/**
* Retrieve merged plugin settings with defaults.
*
* @return array
*/
function adab_get_settings() {
$defaults = adab_get_default_settings();
$saved = get_option( ADAB_OPTION_KEY, array() );
if ( ! is_array( $saved ) ) {
$saved = array();
}
return wp_parse_args( $saved, $defaults );
}
require_once ADAB_PLUGIN_DIR . 'includes/class-adab-settings.php';
require_once ADAB_PLUGIN_DIR . 'includes/class-adab-frontend.php';
/**
* Initialize plugin components.
*/
function adab_init_plugin() {
if ( is_admin() ) {
new ADAB_Settings();
}
new ADAB_Frontend();
}
add_action( 'plugins_loaded', 'adab_init_plugin' );
/**
* Add quick "Settings" link on the Plugins list page.
*
* @param array $links Existing action links.
* @return array
*/
function adab_plugin_action_links( $links ) {
$settings_link = sprintf(
'%s',
esc_url( admin_url( 'options-general.php?page=abhinavdev-announcement-bar' ) ),
esc_html__( 'Settings & Preview', 'abhinavdev-announcement-bar' )
);
array_unshift( $links, $settings_link );
return $links;
}
add_filter( 'plugin_action_links_' . ADAB_PLUGIN_BASENAME, 'adab_plugin_action_links' );
/**
* Add "Leave a Review" and "Contact AbhinavDev" links to the plugin row meta on the Plugins page.
*
* @param array $links Existing row meta links.
* @param string $file Plugin base file.
* @return array
*/
function adab_plugin_row_meta( $links, $file ) {
if ( ADAB_PLUGIN_BASENAME === $file ) {
$links[] = sprintf(
'%s',
esc_url( 'https://wordpress.org/support/plugin/abhinavdev-announcement-bar/reviews/#new-post' ),
esc_html__( '⭐⭐⭐⭐⭐ Leave a Review', 'abhinavdev-announcement-bar' )
);
$links[] = sprintf(
'%s',
esc_url( 'https://profiles.wordpress.org/abhinavdev/' ),
esc_html__( 'Need Custom WP Dev? Contact AbhinavDev', 'abhinavdev-announcement-bar' )
);
}
return $links;
}
add_filter( 'plugin_row_meta', 'adab_plugin_row_meta', 10, 2 );