G

Call a Custom Widget from HTML

Call a custom widget from HTML — mount, Render Element, Content Selector

On a basic HTML page you do not “call” a widget by ID or by pasting a shortcode. You place an empty mount in the markup, then the published widget whose Render Element matches that mount injects the player. Content Selector (or Content Text) decides what is spoken. That is how every custom Full / Button / Circle widget is referenced from HTML — including widgets you create yourself, not only the three default mount classes.

  • Why useful — clear recipe from connection script → your widget → live player, without trial-and-error guessing.
  • No widget ID in HTML — the page never names the console widget by ID; the match is class / selector → Render Element.
  • Defaults vs custom — default mounts (.gsp_full_player / button / circle) are shortcuts; any unique class works the same way.
  • Same on builders — Wix / Shopify / Squarespace Custom HTML blocks use this exact call pattern.

Open Cloud Console HTML connection guide All How-tos

How you “call” a custom widget from HTML

Think of three layers. The connection script loads GSpeech for the whole site. The widget in Cloud Console is the player definition (voice, chrome, selectors, URL rules). The mount in your HTML is the empty node where that player may appear.

  • 1. Connection script — once per site (Integrations → Html Website), usually before </body>.
  • 2. Published widget — Full / Button / Circle you create or customize in the console.
  • 3. Mount in HTML — e.g. <div class="my_listen_btn"></div>; Render Element must be .my_listen_btn.
  • Content Selector — CSS target for page text to narrate (or leave empty and use Content Text for stand-alone audio).

Rule of thumb: HTML never “imports” a widget by name. Matching Render Element + mount class is the call.

How to write id, class, and commas (no coding degree needed)

Content Selector, Render Element, and Exclude List use the same simple language. You only need two prefixes — then you can assemble spoken content in pieces and carve out junk with Exclude.

  • id → # — in HTML id="article" → in GSpeech write #article (hash + the exact id).
  • class → . — in HTML class="post-content" → write .post-content (dot + the exact class). If the element has several classes, one matching class is enough.
  • Tag only — bare tag names work too: article, section, h1 (no # or .).
  • Content Selector + commas — gather content in pieces in one field: #intro,.chapter-body,#summary. Matches are read in order — perfect when the page is split across several wrappers.
  • Exclude List + commas — strip noise from that selection with the same syntax: #comments,.ads,.share-buttons. Excludes apply inside what Content Selector collected.
  • How to find values — on the live page: right-click the block → Inspect. Look for id="…" or class="…", then type them with # or . in the console. Deep Exclude walkthrough: Exclude List & nospeech.

Three default mounts vs your own custom widget

Docs often show the three convenient mount classes because they ship ready with Cloud defaults. A custom widget is not a different product — it is the same Full / Button / Circle type with your Render Element (and usually your Content Selector).

  • Default Full — mount <div class="gsp_full_player"></div> → Render Element .gsp_full_player.
  • Default Button.gsp_button_player mount + matching Render Element.
  • Default Circle.gsp_circle_player mount + matching Render Element.
  • Your custom call — any class or id you own (e.g. #promo-listen or .footer_tts) → set that exact selector as Render Element on the widget you published.

WordPress shortcodes ([gspeech] / button / circle) are a different placement path for posts. On raw HTML there is no shortcode — only the mount + Render Element pair. See default shortcodes for WP only.

End-to-end: configure and call your custom widget

  1. Create / open your website in the Cloud Console and confirm Global defaults in Settings (voice, language) — see Global vs custom.
  2. Copy the Html Website connection script from Integrations and paste it once in your shared template before </body>. Deploy so every page that needs audio loads the script.
  3. Create a Full / Button / Circle widget (or open an existing custom one). Give it a clear name so you recognize it later.
  4. In the page HTML, add an empty mount where the player should appear — pick a unique class you will not reuse for unrelated UI. Example: <div class="my_custom_player"></div>.
  5. On the widget, set Render Element to that exact selector: .my_custom_player (leading dot for a class; #id for an id).
  6. Set Content Selector to what visitors should hear. One wrapper is fine (#main or .product-description). Or assemble pieces with commas: #intro,.body-copy,#summary. Use parent_class / self_class when the mount sits inside that content block.
  7. Optional: Exclude List (also comma-separated, same # / . rules) for nav / ads / comments — e.g. #comments,.ads,.share-buttons. Optional: Allowed / Blocked Urls so this widget only runs where you want.
  8. Set status to Published, Save, hard-reload the live HTML page, and confirm the player fills your mount and reads the right text.

Need audio with no surrounding page text (demo / kiosk style)? Leave Content Selector empty and fill Content Text instead — full walkthrough: Stand-alone player with Content Text.

Minimal HTML page that calls your widget

Below is the shape of a working page. Replace the connection script with yours from Integrations. The mount class must match Render Element on the published widget; Content Selector should target #article in this example.

  • Mount in HTML<div class="my_custom_player"></div> (empty).
  • Widget Render Element.my_custom_player.
  • Widget Content Selector#article.
  • Connection script — your one-line Html Website embed before </body>.

Skeleton (comments show the mapping):

<!-- spoken content -->
<article id="article">…your text…</article>
<!-- player mount (Render Element = .my_custom_player) -->
<div class="my_custom_player"></div>
<!-- GSpeech connection script from Integrations -->

You can put the mount above the article, in a sidebar, or in the footer — Content Selector still points at #article, so layout chrome is not spoken. That layout pattern is also covered in Place a custom widget.

If the custom widget does not appear

  1. Connection script loaded on that URL (View Source / Network).
  2. Widget status is Published (not draft / disabled).
  3. Mount exists on the page and class/id spelling matches Render Element exactly (including the leading . or #).
  4. Content Selector finds real text (or Content Text is filled for stand-alone).
  5. Allowed / Blocked Urls are not excluding this path.
  6. Hard-reload after Save — HTML/CDN cache can keep an old shell briefly.

Full troubleshooting path: Player not showing.

Custom HTML widget FAQ

  • Where do I put the widget ID in my HTML?

    Nowhere. HTML does not reference the console widget ID. The call is: empty mount in the page + Render Element on the published widget set to that mount’s selector.
  • Can I use a class that is not gsp_full_player / button / circle?

    Yes. Those three names are convenient defaults, not a hard limit. Any unique class or id works if Render Element matches it and the widget is Published.
  • I created a custom widget — why does nothing happen on the page?

    Creating the widget is only half of the call. The page also needs a mount that matches Render Element, the connection script, Published status, and URL rules that allow that page. Without the mount, the widget has nowhere to inject.
  • Can Content Selector list more than one element?

    Yes. Separate selectors with commas to assemble narration from several pieces — e.g. #intro,.chapter-body,#summary. Then trim junk with Exclude List using the same comma syntax (#comments,.ads). Remember: HTML id#, class..
  • One widget, many pages?

    Yes. Reuse the same mount class on every template; one published widget fills every matching mount allowed by Allowed / Blocked Urls. Create another widget only when voice, design, or selectors must differ.