Share Widget
Full guide to the WidgetCore Share widget: Iranian and global networks, custom share URL patterns with {url}/{title} placeholders, a copy-link button with aria-live feedback, shapes and Normal/Hover colors.
The Share widget builds the share buttons of the current page server-side from the permalink (get_permalink) and the title (get_the_title), so the links work with JavaScript disabled. Iranian and global networks are built in, and any other network is added with a custom URL pattern. The only script the widget has powers the copy-link button, and it loads solely on pages that use the widget.
| Item | Value |
|---|---|
| Widget ID | wgcr-share |
| Panel title | Share |
| Category | WidgetCore widgets (wgcr) |
| Style / script | wgcr-share / wgcr-share |
| Root class | .wgcr-share |
"Networks" section
The Share networks (networks) control is a repeater; pick the Network (net) in each row:
| Network | ID | Share URL pattern |
|---|---|---|
| Telegram | telegram | https://t.me/share/url?url={url}&text={title} |
whatsapp | https://api.whatsapp.com/send?text={title}%20{url} | |
| Eitaa | eitaa | https://eitaa.com/share/url?url={url}&text={title} |
| X (Twitter) | x | https://twitter.com/intent/tweet?url={url}&text={title} |
facebook | https://www.facebook.com/sharer/sharer.php?u={url} | |
linkedin | https://www.linkedin.com/sharing/share-offsite/?url={url} | |
email | mailto:?subject={title}&body={url} | |
| Copy link | copy | A clipboard button (not a link) |
| Custom | custom | Your own pattern with {url} and {title} placeholders |
{url} is replaced with the current page URL and {title} with its title (both percent-encoded).
Custom networks (Bale, Rubika, Soroush and anything else)
Iranian messengers other than Eitaa do not publish a documented web share endpoint; for any service that does offer one, add a Custom row and fill its three fields:
| Field | ID | Notes |
|---|---|---|
| Custom network label | custom_label | The button's name (e.g. "Bale"); an empty field prints "Custom network" |
| Share URL pattern | custom_url | For example https://example.test/share?url={url}&text={title}; a row without a pattern is skipped. The field also offers Elementor dynamic tags |
| Custom network icon | custom_icon | Share / link / globe / envelope / phone |
The rest of the section
| Control | ID | Type | Default | Notes |
|---|---|---|---|---|
| Show the network name next to the icon | show_label | switcher | Off | While off, the label stays in the DOM as hidden for screen readers and the copy feedback |
| Heading above the buttons | heading | text | Empty | For example "Share this post:" |
| Copy button label | copy_label | text | "Copy link" (translated) | — |
| Label after copying | copied_label | text | "Copied!" (translated) | Temporary feedback on the button with aria-live="polite" |
| Open links | target | select | New tab | target="_blank" with rel="noopener noreferrer"; email always opens in the same tab |
Copy link
The copy button uses the modern Clipboard API first and falls back to the legacy method (textarea + execCommand). After copying, the button label switches to "Copied!" for a moment — even when labels are hidden — and because it is aria-live="polite", screen readers announce it too.
HTML output
<div class="wgcr-share" data-shape="rounded">
<p class="wgcr-share-heading">Share this post:</p>
<ul class="wgcr-share-list">
<li>
<a class="wgcr-share-link" href="https://t.me/share/url?url=…&text=…" target="_blank" rel="noopener noreferrer">
<span class="wgcr-share-ic">…svg…</span>
<span class="wgcr-share-text" hidden>Telegram</span>
</a>
</li>
<li>
<button type="button" class="wgcr-share-link wgcr-share-copy" data-copy="https://…" data-copied="Copied!">
<span class="wgcr-share-ic">…svg…</span>
<span class="wgcr-share-text" aria-live="polite" hidden>Copy link</span>
</button>
</li>
</ul>
</div>
If no valid row remains, the widget prints nothing. The icons are inline SVGs from the plugin's shared library (dedicated glyphs for X, Facebook, LinkedIn, Telegram, WhatsApp and Eitaa, generic icons for the rest).
Style sections
- Buttons: "Button shape" (rounded / circle / square), "Layout", "Space between buttons", "Icon size", "Button padding" and the color controls "Button background" / "Icon and text color" in the Normal tab and "Background on hover" / "Color on hover" in the Hover tab.
- Title and Text: "Title color" for the heading and its typography, "Network names color" and "Network names color on hover".
All colors run through the widget's CSS variables; that is why hover always applies even when Normal-state colors are set.
Custom style example
/* Outline buttons that fill on hover */
.wgcr-share .wgcr-share-link { box-shadow: inset 0 0 0 2px currentColor; background: transparent; }