• Resolved Darcey1

    (@darcey1)


    I am using Twenty Twenty-Three with the Full Site Editor, trying to add some code to a CTA button. Important: the CTA button sits in the first section of the body of the page, not the sidebar or header or footer. The goal: when the user clicks the large CTA button (“Get early access”), they see a popup for a newsletter subscription.

    The subscription service is Mailer Lite. I tried the MailerLite plugin, but it only works with older themes as a widget in the sidebar, header or footer.

    Using the WPCode “Code Snippets” plugin, I was able to add the code to the <head> section. This successfully activated the automatic popup when a user goes to leave the page (top or bottom of page).

    Now I just need to activate the large CTA button. To do that, I need to add this code somewhere:

    <button class="ml-onclick-form" onclick="ml('show', 'hPKtnC', true)">Get early access</button>
    
    

    I have been able to add the CSS class ml-onclick-form to the CTA button, however, only the CSS class, not the onClick interaction which (I think?) is javascript.

    I found the Shortcode Block in the Site Editor and tried adding it using the Shortcode provided in the free version of WPCode, but it doesn’t seem to have any effect. I tried adding it under the button and then within the div for the button using the Code Editor. Neither worked.

    Maybe I need to pay for the Pro version of the WPCode plugin? But the WPCode plugin already supplies the shortcode so it should work with the ShortCode block, right?

    Or maybe all I need is a custom HTML block…?

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author Mircea Sandu

    (@gripgrip)

    Hi @darcey1,

    From what I can see I think you should be able to add that button as a WPCode shortcode by creating a new HTML snippet and adding the button code in your message above inside the snippet.

    Please make sure you select the Shortcode mode and also activate the snippet after saving it as otherwise the shortcode will not output anything.

    With that set up you can use the Shortcode block to place the snippet anywhere you can add that block.

Viewing 1 replies (of 1 total)
  • The topic ‘Adding MailerLite code to a CTA to generate a newsletter popup’ is closed to new replies.