{ button.addEventListener('click', () => { document.getElementById('actionbutton-edit-index').value = button.dataset.index; document.getElementById('actionbutton-edit-text').value = button.dataset.text; document.getElementById('actionbutton-edit-link').value = button.dataset.link; document.getElementById('actionbutton-edit-color1').value = button.dataset.color1; document.getElementById('actionbutton-edit-color2').value = button.dataset.color2; document.getElementById('actionbutton-edit-fontcolor').value = button.dataset.fontcolor; document.getElementById('actionbutton-edit-modal').style.display = 'block'; }); }); "; wp_add_inline_script('jquery-core', $js); } add_action('admin_enqueue_scripts', 'actionbutton_admin_assets'); // Settings page function actionbutton_settings_page() { $buttons = get_option('actionbutton_buttons', []); if (!empty($_POST) && !check_admin_referer('actionbutton_buttons_action', 'actionbutton_buttons_nonce')) { wp_die('Security check failed'); } if (isset($_POST['actionbutton_add_button'])) { if (count($buttons) < 1) { $new_button = [ 'text' => isset($_POST['button_text']) ? sanitize_text_field(wp_unslash($_POST['button_text'])) : '', 'link' => isset($_POST['button_link']) ? esc_url_raw(wp_unslash($_POST['button_link'])) : '', 'color1' => isset($_POST['button_color1']) ? sanitize_hex_color(wp_unslash($_POST['button_color1'])) : '', 'color2' => isset($_POST['button_color2']) ? sanitize_hex_color(wp_unslash($_POST['button_color2'])) : '', 'font_color' => isset($_POST['font_color']) ? sanitize_hex_color(wp_unslash($_POST['font_color'])) : '', ]; update_option('actionbutton_buttons', [$new_button]); $buttons = [$new_button]; } } if (isset($_POST['actionbutton_delete_button'])) { update_option('actionbutton_buttons', []); $buttons = []; } if (isset($_POST['actionbutton_edit_button'])) { $index = isset($_POST['button_index']) ? intval($_POST['button_index']) : 0; if (isset($buttons[$index])) { $buttons[$index] = [ 'text' => isset($_POST['edit_button_text']) ? sanitize_text_field(wp_unslash($_POST['edit_button_text'])) : '', 'link' => isset($_POST['edit_button_link']) ? esc_url_raw(wp_unslash($_POST['edit_button_link'])) : '', 'color1' => isset($_POST['edit_button_color1']) ? sanitize_hex_color(wp_unslash($_POST['edit_button_color1'])) : '', 'color2' => isset($_POST['edit_button_color2']) ? sanitize_hex_color(wp_unslash($_POST['edit_button_color2'])) : '', 'font_color' => isset($_POST['edit_font_color']) ? sanitize_hex_color(wp_unslash($_POST['edit_font_color'])) : '', ]; update_option('actionbutton_buttons', $buttons); } } ?>

ActionButton Settings

Button Text
Button Link
Gradient Color 1
Gradient Color 2
Font Color

Only one sticky action button is allowed in the free version.

Existing Button

$b) : ?>
TextLinkShortcodeActions
[action_button id=""]