Adding Widget to Your WordPress Site
How to Add the Playgama Widget to Your WordPress Website (Step-by-Step)
Looking to embed the Playgama widget on your WordPress site? Whether you want it on all pages or just one, this guide walks you through the exact steps to add the Playgama widget using functions.php
. No plugins needed β just clean, native WordPress code!
To get your own Widget ID (e.g., WA0000000000000
), follow these steps:
Log in to your Playgama account.
Create a new widget in your dashboard.
Once it's created, check the embed code β your unique
widget_id
will be included there.If your widget is already created, go to its page and click the </> button to view the embed code.
Step 1: Open Your Themeβs functions.php
File
functions.php
FileUsing FTP or your hosting file manager, navigate to:
Replace <THEME_NAME>
with your active theme's folder name.
Step 2: Load the Playgama SDK Script
Paste this code inside the functions.php
file to enqueue the Playgama JavaScript SDK:
This ensures the Playgama script is loaded efficiently on the frontend of your site.
Step 3: Initialize the Widget
Option A: Show the widget on all pages
Add this snippet to functions.php
if you would like to initialize the widget on every page:
π Don't forget to replace widget_id
with your own Widget ID!
Next, add this HTML code wherever you want the widget to appear on your site:
Option B: Show the widget on specific pages only
If you only want the widget on selected pages (like your homepage, contact page, or a landing page), you may embed the initialization script directly where the widget should appear. See the next step.
Step 4: Insert the Widget HTML in Your Page or Template
Wherever you want the Playgama widget to appear, add this HTML snippet:
Place it in your page content (using a custom HTML block) or directly inside your template file (e.g., data/html/wp-content/themes/<THEME_NAME>/templates/page.html
).
β
Be sure to use your own widget_id
instead of the example!
Tips for Developers
You can change the
width
andheight
values in thestyle
attribute to adjust the widget size.The widget is fully responsive, but for the basic version with 3 games, we recommend a size of 510Γ180 pixels to ensure a clean, balanced look on both desktop and mobile.
Max game height is 320 px.
It works with any custom or child theme
Script is loaded asynchronously to avoid slowing down your site
No need for third-party plugins
Clean and SEO-friendly integration
Last updated