Skip to content
TheChatArchiveThe Chat Archive
ClaudeClaude (model unspecified)· AnthropicHugging Face ShareLM (browser-extension contributions)

I'm using brevo and wordpress, how to create a button so when registering people can…

  1. User

    I'm using brevo and wordpress, how to create a button so when registering people can subscribe to the site, as well as a widget to add email to subscribe?

  2. Claude Assistant

    I'll help you set up email subscription functionality with Brevo (formerly Sendinblue) and WordPress. Here are two approaches for what you're looking for: For Registration Page Subscription Method 1: Using Brevo's WordPress Plugin

    Install the official "Brevo" plugin from your WordPress admin Go to Settings > Brevo and connect your account with your API key In your registration form, add a checkbox field with code like:

    html Subscribe to our newsletter

    Use a hook in your theme's functions.php to handle the subscription when users register

    Method 2: Custom Integration Add this to your theme's functions.php: phpfunction handle_registration_subscription(user_id) { if (isset(_POST['brevo_subscribe']) && _POST['brevo_subscribe'] == '1') { user = get_userdata(userid);//CallBrevoAPItoaddsubscriberwpremotepost(′https://api.brevo.com/v3/contacts′,array(′headers′=>array(′api−key′=>′your−brevo−api−key′,′Content−Type′=>′application/json′),′body′=>jsonencode(array(′email′=>user_id); // Call Brevo API to add subscriber wp_remote_post('https://api.brevo.com/v3/contacts', array( 'headers' => array( 'api-key' => 'your-brevo-api-key', 'Content-Type' => 'application/json' ), 'body' => json_encode(array( 'email' => user->user_email, 'listIds' => [your-list-id] )) )); } } add_action('user_register', 'handle_registration_subscription'); For Email Subscription Widget Option 1: Brevo Forms

    In your Brevo dashboard, go to Forms Create a new subscription form Customize the design and fields Copy the embed code In WordPress admin, go to Appearance > Widgets Add a "Custom HTML" widget where you want it to appear Paste the Brevo form embed code

    Option 2: Custom Widget Create a simple HTML form widget: html Subscribe

    Make sure you have proper GDPR compliance with checkboxes and privacy policy links Test the integration thoroughly before going live Consider using double opt-in for better list quality Style the forms to match your site's design

    Would you like me to elaborate on any of these approaches or help you implement a specific method?