• Resolved 33ia

    (@33ia)


    I want to add a button to launch (open) the chat please? I’m using the pro plugin

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

Viewing 1 replies (of 1 total)
  • Plugin Author Jordy Meow

    (@tigroumeow)

    Hi,

    You can use this code, for example:

    add_filter( 'mwai_chatbot', function( $content, $params ) {
      $id = $params['id'];
      ob_start();
      ?>
      <script>
        let chat = document.querySelector('#mwai-chat-<?= $id ?>');
        chat.style.display = 'none';
        function showMyChat() {
          chat.style.display = 'block';
          chat.classList.add('mwai-open');
        }
      </script>
      <?php
      $output = ob_get_contents();
      ob_end_clean();
      return $content . $output;
    }, 10, 2);

    That will hide the chatbot, and create a function showMyChat, that you can call anytime, in a button, in a link, or anywhere else 🙂

Viewing 1 replies (of 1 total)

The topic ‘Launcher button’ is closed to new replies.