Video Conference Kit
  • iOS
  • Android
  • Web : JavaScript
  • Flutter
  • React Native
  • Overview
  • Quick start
    • Using HTML script
    • Using NPM package manager
    • Using WordPress
  • Custom prebuilt features
  • Authentication and Kit Token
  • Documentation
  • Video Conference Kit
  • Quick start
  • Using WordPress

Using WordPress

Last updated:2023-10-20 11:43

In this guide, we will get started using Call Kit on WordPress with a few steps. Let's try this out:

/Pics/Prebuilt_Web/wordpress_call_effect.png

Step 1: Add a new page

Log in to the WordPress dashboard, and in the sidebar panel, click Add New to create a new page.

/Pics/Prebuilt_Web/wodpress_dashboard.png

Step 2: Add a custom HTML

After creating a new page, click on the + button, and then click Custom HTML to add a custom HTML.

/Pics/Prebuilt_Web/wordpress_add_html.png

Step 3: Add Call Kit code in an HTML block

After adding a custom HTML, copy the prebuilt code from the below snippet.

  • You'll need to generate a Kit Token.

    (Note: You can skip this step if you wanna speed up your integration testing. Remember to generate the Kit Token by referring to this when you plan to make your app go live officially.)

<script>
function getUrlParams(
  url  = window.location.href
) {
  let urlStr = url.split('?')[1];
  return new URLSearchParams(urlStr);
}
  var script = document.createElement("script");
  script.type = "text/javascript";

  script.addEventListener("load", function (event) {
     // Generate a Kit Token by calling a method.
    // @param 1: appID
    // @param 2: serverSecret
    // @param 3: Room ID
    // @param 4: User ID
    // @param 5: Username
    const roomID = getUrlParams().get('roomID') || Math.floor(Math.random() * 10000) + "";
    const userID = Math.floor(Math.random() * 10000) + "";
    const userName = "userName" + userID;
    const appID =  ;
    const serverSecret = "";
    const kitToken =  ZegoUIKitPrebuilt.generateKitTokenForTest(appID, serverSecret, roomID, userID, userName);



    const zp = ZegoUIKitPrebuilt.create(kitToken);
    zp.joinRoom({
        container: document.querySelector("#root"),
        sharedLinks: [{
            url: window.location.protocol + '//' + window.location.host + window.location.pathname + '?roomID=' + roomID,
        }],
        scenario: {
            mode: ZegoUIKitPrebuilt.VideoConference,
        },

    });
  });

  script.src =
    "https://unpkg.com/@zegocloud/zego-uikit-prebuilt/zego-uikit-prebuilt.js";
  document.getElementsByTagName("head")[0].appendChild(script);
</script>

Step 4: Provide appID and serverSecret

Then, replace the appID and serverSecret parameters in the following code with your project's AppID and ServerSecret that you get from Admin Console.

/Pics/Prebuilt_Web/wordpress_code_call_appID.png

Step 5: Preview

After clicking the Save draft, the last step is to execute the code by clicking the Preview button.

/Pics/Prebuilt_Web/wordpress_call_preview.png

Congratulations! So far, you've finished all the steps.

Page Directory