Installing Highlight and Share in the WordPress Admin
Highlight and Share is a free plugin: Please visit the plugin on the WordPress Plugin Directory
Install from the WordPress Admin
Log into your WordPress admin (i.e., your dashboard)
Go to Plugins->Add New
Type in "Highlight and Share"
After activation, you can find the plugin's settings in the Dashboard under Settings->Highlight and Share.
Install via FTP
Download the plugin zip file
Unzip the plugin zip in a place you can remember for the next steps
Log into your FTP program of choice for your website
After activation, you will be taken to the plugin's settings screen.
How Highlight and Share Works
Highlight and Share at its core is a highlighter. If users select some text, the user will be shown a row of enabled social networks.
Content Sharing (Text Selection)
Highlight and Sharing displays a small pop-up when a reader highlights text on your site.
What is Content Sharing?
Highlight and Share lets you share content in multiple ways, including text highlighting, inline highlighting, and the Click to Share block or shortcode.
To configure Content Sharing, and select the Content Sharing tab.
From there, you can configure which social networks are shown, adjust display settings, and set the appearance settings.
For convenience, each network that shares text is clearly labeled.
Configuring a Network's Label, Tooltip, and Settings
Click on the Cog icon to view additional settings for a social network.
All networks allow you to edit the label and tooltip for each network.
Setting "X" Additional Settings, Including Default Username and Hashtags
Networks like "X" allow you to set a default username and enable hashtags.
If Hashtags are enabled, they will appear as tags in the post's sidebar settings.
Setting the Default WhatsApp Endpoint
Another special network is WhatsApp. You can set the endpoint to point to the native desktop application or the web application. You can also choose whether to share the post's URL along with the text.
Welcome to Highlight and Share
The goal of Highlight and Share is to provide an intuitive, lightweight, and extremely flexible way for users to see social sharing options when interacting with your site's content, images, or headlines.
How Highlight and Share Works
Text Selection
Highlight and Sharing displays a small pop-up when a reader highlights text on your site.
By default, this works on any post or page content. You can customize Highlight and Share to show anywhere using advanced selectors.
Inline Highlighting
You can mark a selection of text as an inline highlight using the Block Editor format option, or wrap a selection with a CSS class has-inline-text.
Click to Share Block and Shortcode
The Click to Share block and shortcode let you heavily customize a "Click to Share" box that readers can click to share.
Image Sharing
Share your images using Pinterest or the Web Share API.
Headline Sharing
Headline sharing lets you share your headers, giving users quick access to copy the headline link and to share it across other social networks.
Highlight and Share is Free: Please on the WordPress Plugin Directory.
Inline Highlighting Shows Social Networks on Click
Click to Share Block/Shortcode to Show Social Networks
Share to Pinterest and Use the Web Share API
Headline Sharing Allows You to Share Headers
The Appearance Settings
The Appearance Panel under Content Sharing
Adjusting the appearance of Highlight and Share is fast and intuitive. You can choose between several themes, change the orientation and tooltip behavior, and reorder enabled networks.
Headline Sharing allows users to share your headings when viewing your site. This feature was inspired by how GitHub does its headlines, with some updates for UX and accessibility.
When enabled, the plugin will scan your headings that have an ID attribute. If found, it'll show a small link icon next to the headline when it is focused or hovered over.
You're able to add up to 4 social networks to show when sharing a headline. The "Copy Link" feature must always be enabled for accessibility, as it is natural UX behavior.
The link icon is fully accessible and works with or without JavaScript.
Configuring the Block Editor Settings
Enable of Disable the Block if not in use
If you do not need to use the block's features, you can disable the block in the Content Sharing tab under the Block Editor Panel.
Excluding Certain Headlines
You can exclude headlines or headlines in containers by adding a CSS class:
Setting Exclusion Selectors
You can set CSS selectors to automatically exclude certain headlines. For now, this only works with CSS classes.
Reordering the Social Networks
You can customize the order of the social networks shown
You can find the Reorder section in the Appearance panel in the Content Sharing tab.
Simply drag and drop to reorder the networks.
Be sure to save your changes when reordering is complete.
Reordering the Networks under the Appearance Panel
Reorder Networks by Dragging and Dropping
has-headline-exclude
Exclusion Selectors Option
Excluding Headings
You can exclude headlines or headlines in containers by adding a CSS class:
Adding IDs to Headlines
Headlines without IDs are skipped automatically, although there is an admin option to enable auto-ID generation. This plugin runs its content filters late to allow other plugins to add their own IDs, making this compatible with many Table of Contents plugins.
Setting the Social Networks
You can select up to four social networks to display next to headline sharing. As this feature is still experimental and we're still receiving user feedback, there isn't much in terms of customization.
Copy must always be selected. You can select up to three additional networks.
has-headline-exclude
Configuring a Custom Theme
Choose a custom theme to modify how Highlight and Share shows on the frontend
Choosing a Custom Theme Presents Several Configuration Options
When selecting a custom theme, you will be presented with several options to configure how the icons display on the frontend.
This section will cover the available customization options.
Hide or Show Labels
You can choose to show or hide the labels of the social networks.
You can customize the labels in the main Settings tab when enabling social networks.
Item Grouping (Grouped)
When the items are grouped, you can edit the social networks all at once.
You can adjust:
The background color and background color on hover for all the icons
The text color and text color on over (if labels are enabled)
Adjust the border radius of the container
Item Grouping (Ungrouped)
To edit the icons individually, you can ungroup the social networks.
When items are ungrouped, you can configure the colors of each social network icon individually.
Just click on each social network tab to adjust the colors for each network.
In addition to configuring colors, you can customize the appearance of:
The individual icon border radius
The individual icon padding
The icon size
Advanced Selectors
Advanced Selectors for Specific Targeting
Highlight and Share supports custom selectors, whether you use a page builder or a non-default editor.
Custom selectors are handy when you are using a page builder and the content is not within the normal content loop.
In general, you shouldn't have to choose a selector unless directed to do so by support or a developer.
CSS Class Selectors
Input any CSS classes (with or without the dots and comma-separated).
Highlight and Share will search for these classes and be enabled for any text within them.
An example would be enabling Highlight and Share for widget areas.
CSS ID Selectors
Input any CSS IDs (with or without the # sign and comma-separated).
Highlight and Share will search for these IDs and will be enabled for any text within the CSS ID.
HTML Elements
Input any HTML elements (e.g., section, main).
Highlight and Share will search for these elements and be enabled for any text within them.
Post Wrapper Classes
Add any additional CSS classes when Highlight and Share successfully wraps the content. You can use this for advanced CSS targeting.
Setting the Display Settings
In addition to enabling headlines, you can adjust their display settings and appearance.
To exclude a headline or a headline in a container, use the has-headline-exclude class.
Generate Missing IDs
Not all headlines have an ID attribute, commonly known as an anchor attribute. You can toggle this option to allow Highlight and Share to generate the IDs for you.
Since the plugin runs its content filter late, other plugins should have had a chance to add their own ID attributes to the headlines. This makes Highlight and Share compatible with many Table of Contents plugins out of the box.
However, if you want auto-generation and don't have a helper plugin, you can force the plugin to generate missing IDs.
Use this in conjunction with the has-headline-exclude class to exclude headlines or headlines in wrappers.
Link Icon Always Visible Option
You can make the link icon always visible on the frontend by toggling this option. By default, the link icon is only shown on headline focus or hover.
When visible, the link icons are more prominent.
Excluding Headline Levels
You can exclude certain headline levels from being selected for sharing. You can select from all six heading levels.
Enabling on Post Types
You can enable headlines on certain post types. By default, they are only enabled for posts.
You can auto-enable existing post types in this section.
Even if you have headline sharing disabled for a post type, you can still enable it individually by editing the post and enabling headline sharing in Highlight and Share's sidebar settings.
Setting Exclusion Selectors
You can set CSS selectors to automatically exclude certain headlines. For now, this only works with CSS classes.
Enabling Headline Sharing
You can find Headline Sharing under the Headline Sharing tab in the admin settings.
Headline Sharing Admin Options
Headline sharing is still experimental and is in the user feedback stage of feature development. It may not work with all themes, so please check your site after enabling Headline Sharing.
Headline Sharing is Off by Default
Headline Sharing is off by default because it can affect your theme's output. It is recommended to enable this option on a staging site and ensure everything is working there before enabling it in production. If you do not have a staging site, please double-check that your site appears unchanged on the frontend.
To enable headline sharing, select the "Enable Headline Sharing" toggle and save the settings.
You can then hover or focus on any headline with an ID attribute.
How to Add Inline Highlighting to Text
Highlighting text is incredibly simple
Inline highlighting works in the block editor or by wrapping a span around the text with a CSS class has-inline-text.
Add Inline Highlighting in the Block Editor
Inline highlighting is very simple. Simply highlight some text in the block editor, and select Inline Social Highlight from the More context menu.
Adding Inline Highlighting Via Code (HTML Attribute)
If you need to highlight text outside of the block editor, just wrap a span element around the text and give it a class of has-inline-text.
The Theme Preview
The theme preview shows what Highlight and Share will look like on the frontend
Theme Preview in the Content Sharing Tab
You can find the theme preview at the bottom of the Appearance tab.
Should you choose to reorder any social networks or customize or change a theme, you will find that the preview automatically updates.
Be sure to save any settings when you are through with any theme modifications.
Email Sharing
This page goes over how email sharing works
Email Option on the Frontend
When enabled, emails are a powerful feature and allow users to send themselves or someone else an email about the text selection, highlight, or quote.
When the email is clicked on, a user is shown a modal where the user can input any sharing details.
The Email Modal for Email Sharing
To prevent any spam or bot submissions, Akismet and reCAPTCHA 3 are supported.
Setting the Social Networks
Setting up the social networks is easy. You're able to add up to 4 social networks to show when sharing a headline. The "Copy Link" feature must always be enabled for accessibility, as it is natural UX behavior.
Setting the Networks
Find the Social Networks Panel under Headline Sharing and select up to 4 networks. Four networks isn't a hard rule for now, but to introduce the headlines feature, a sane limit was set on what is displayed.
When all four networks are selected, the remaining networks will be disabled.
What is Image Sharing?
Enable Pinterest and Web Sharing on images
One of Highlight and Share's features is image sharing. You can find the Image Sharing settings in the Highlight and Share settings under the Image Sharing tab.
If image sharing is enabled, you'll see the following when hovering over an image:
You have two options for image sharing:
Pinterest (shows on Desktop and Mobile)
Custom Shortcode Themes
If you are going to provide your own styles, you can do so via the shortcode parameters or by creating your own CSS theme for the shortcode.
To specify a theme in the shortcode, just pass a theme-slug as part of the theme shortcode parameter:
There will be a CSS wrapper around the shortcode with custom-red, which you can then style.
Several CSS variables can be used to style the various parts of the Click to Share box. These are listed below:
Configure Inline Highlighting
You'll find inline highlighting options in the Content Sharing tab
You can find the Inline Highlighting panel under the Content Sharing tab in the admin settings.
You're able to:
Enable or disable inline highlighting.
Change the highlight's background color and hover background color.
Generate Missing IDs Option
Link Icons Shown by Default
Select Headline Levels Worth Sharing
Post Type Settings for Headline Sharing
Sidebar Settings on a Post or Page When Editing
Exclusion Selectors Option
Set icon padding for all icons at once
Increase or decrease the icon size for all items
Set the font size of the labels (if labels are enabled)
Show or hide tooltips
Set the vertical or horizontal orientation of the icons
Headlines Interface with All Social Networks Selected
For each enabled network, you can edit the button text shown in the headline.
Share This Button Text is Configurable on the Frontend
These networks will be shown on the frontend.
Demo of Headlines in Action on the Frontend
Reordering the Networks
Find the Appearance pane under Headline Sharing.
Reorder Interface
Drag and drop from left to right. The networks will be displayed on the frontend in order, top to bottom.
Headline Order of the Social Networks
Social Network Toggle Selection
Web Share (shows only on compatible browsers)
Clicking the Pinterest icon lets the user share on Pinterest.
Web Share API
The Web Share API is native to the user's device, so it behaves slightly differently on iOS than on Android.
For example, on iOS, you can use Web Share to copy the image and save it to Dropbox or other native functions, depending on your device and apps.
Web Share on iOS
How the Web Share API Works
When someone clicks on the Web Share icon to share an image, the image is silently downloaded behind the scenes and stored as a file reference so that the user can then save or copy it onto their device.
The user's device is sent:
URL where the image is displayed.
Image file so the image can be copied, saved, or transferred.
How Highlight and Share Matches the Images
Image matching uses the DOMDocument class to parse and match the images. This allows the Pinterest and Webshare icons to be added natively to the HTML document, displayed via CSS and interacted with via JavaScript.
Check your site's front end after enabling image sharing and make sure nothing has changed regarding its layout.
Highlight and Share Image Settings
Sharing Options on an Image
Change the highlight's text color and hover text color.
Enable the Inline Highlighting tooltips.
Adjusting the Highlight Colors
Adjust the Highlight Colors With a Preview Below
You can change the highlight color when highlighting text. You can change the:
Background color
Background hover color
Text color
Text color on hover
A preview is below the colors, showing how the highlight will look on the frontend.
Showing a Tooltip on Hover
Show Tooltips When Hovering Over a Highlight
You can enable a tooltip for inline highlighting when someone hovers over a highlight. Within this section, you can:
Change the tooltip text.
Adjust the tooltip background color.
Adjust the tooltip text color.
Example Tooltip on an Inline Highlight
As shown in the image above, when hovering over a highlight, a tooltip displays instructions for the user.
The Display Rules panel allows you to control where content sharing is enabled. This primarily controls text selection sharing.
Display Rules Panel in the Content Sharing Tab
Configuring Content Sharing Per Post Type
By default, content sharing is enabled for all post types in Highlight and Share. You can exclude post types via the "Excluded Post Types" setting.
Excluded Post Types Option for Content Sharing
You can still selectively enable or disable text sharing via sidebar settings when editing a post.
Enable on Content Areas (Content, Excerpt, and Comments)
A useful setting is the ability to disable text selection on the main content area. Use this if you have content enabled in post types but would like to skip the content area when sharing.
You can also allow text and social sharing on excerpts, and enable it for the comments section.
If you have a page builder, these settings may have no effect. In that case, you'll need .
Enable or Disable for Mobile Devices
Most mobile devices already have content sharing when highlighting text, but you can enable Highlight and Share's additional networks on mobile devices by default. If you wish to disable Highlight and Share on mobile devices, uncheck this option.
Setting a Sharing Prefix and Suffix
For social networks with text sharing enabled, you can wrap the text in a prefix and suffix, for example, a quotation mark, a parenthesis, or other punctuation.
Here's an example post with the prefix and suffix shown:
Enabling Shortlinks
You can find the Shortlinks setting in the Display Rules panel under Content Sharing.
Shortlinks let you share a shorter version of a URL. You will need a shortlink service installed, , for this to work.
The shortlink will display for any social network that allows URL sharing, which is most of them. Here are some compatible WordPress services for shortlinks.
Choosing a Theme, Setting Tooltips, and Orientation
Choose from several included themes or choose a custom theme
Changing the appearance of content-sharing icons is easy. You can find the settings under the Appearance panel under the Content Sharing tab.
Built-in Themes
Choose from several built-in themes to quickly customize the look of Highlight and Share.
The Click to Share Block
Create a clickable quote for sharing to the social networks
Finding the Block
Use a / Command and look for Click to Share.
Email Admin Settings
Configure spam protection in the email admin settings
In the Email Settings tab under Highlight and Share settings, you can configure several email-related settings.
Form vs Mailto
Available Themes
Unless otherwise noted, the available themes show only the icons, not the labels. A tooltip is available on hover if that option is enabled.
Default Theme
The default theme shows brand colors and labels.
The Default Theme
Brand Colors Theme (icons only)
Branded Icon Theme
Colorful Circles Theme
Colorful Circles Theme
Colorful Glass Circles Theme
Colorful Glass Circles Theme
Orbs Theme
Orbs Theme
Black Theme
Black Theme
Purple Theme
Purple Theme
White Theme
White Theme
Cyan Theme
Cyan Theme
Magenta Theme
Magenta Theme
Blue Theme
Blue Theme
Green Theme
Green Theme
Icon Size
You can customize the icon size (default is 25) for any available theme.
Adjust the Icon Size for All Available Themes
You can see a real-time preview in the Preview pane.
Tooltips
Tooltips Option
By default, a Tooltip is shown when hovering over a social network.
Tooltip Showing on Hover
To remove the Tooltips, simply toggle the Tooltip option and save your changes.
You can modify the Tooltips for each network in the Social Networks panel.
Orientation
You can choose between horizontal and vertical orientation.
Orientation Settings in the Appearance Panel for Content Sharing
Vertical Orientation on the Frontend
Custom Themes
If you would like to customize the theme to your own specifications, you can select "Custom" from the theme dropdown.
Alternatively, use the "+" Block Inserter icon to search for "Click to Share".
You'll see several variations of the block. Insert the main "Click to Share" block for a default palette. Three variations are available (Dark, Bold, and Royal).
Click to Share Blocks Using a Slash Command
Block Overview
Main Block Interface
In the main block interface, you will find an editable section for the Quote or text you would like to share. There is also a CTA that you can edit.
The block toolbar reveals (1) a popover modal, which allows you to trim down or customize any shareable text.
Next, you can update the Click to Share text (2), and customize the Click to Share CTA (3) and Icon (4).
The Click to Share Text
Add In Your Click to Share Text and Go Back to Block Settings
The Click to Share text works as an inner block and allows you to place as much paragraph text as you desire. There are quick shortcuts in the block and in the toolbar to go back to the block settings when you are done entering share text.
You can also customize what's shareable if your share text is too long or needs formatting. You can edit this by clicking on the "Quote" icon in the toolbar. This is often used when Twitter(X) is the primary network, and you need to trim down some text.
Customize the Shareable Quote for Text Selection
Choosing a Theme
Choose a Theme Via the Sidebar Options
There are several pre-built themes, as well as support for a Legacy theme intended for older users of the block. It is still maintained, but switching to the new theme system is much more future-proof and user-friendly.
Sidebar Options
There are numerous sidebar options to customize how the Click to Share block will show up on the frontend.
Share Settings
The Share Settings for the Click to Share Block
With the Share settings, you can:
Hide or show the Click to Share CTA
Adjust the Click to Share CTA
Show or hide the Share icon
Adjust the icon size
Change the Sharing Icon
Here's a quick GIF of those items in action.
Adjusting Click to Share Block Settings
As shown in the GIF, several sharing icons are available for you to choose from.
Available Sharing Icons
Color Overrides
If you have selected a theme, but want to override certain aspects of it, you can quickly adjust the colors to match your branding. These are considered opt-in overrides, so you don't have to adjust every color if you don't want to.
When you "Sync Color States", you change both the normal and hover colors at the same time.
Typography Overrides
You can override the typography for both the share text and the CTA.
Typography Options for the Quote and Share Text Typography
Clicking the popover reveals several typography options.
Typography Options for Sharing Text
As with colors, typography options are optional and are considered overrides.
Setting the Spacing and Border
You can also set overrides for spacing and borders. You can also adjust the block's maximum width.
Border, Padding, and Margin Options
You can further configure the block via the admin settings.
Clearing Theme Overrides
Theme Overrides Can Be Cleared Here
If you wish to revert all override changes you've made, select "Clear Theme Overrides," and the block will revert to the defaults.
The Click to Share Block in the Block Editor
Form
When selecting Form, you're allowing someone to send an email to someone else from your site. You can configure the overall template when sending out form emails by using the available merge controls next to each text field.
Since emails are being sent from your site to others, either Cloudflare Turnstile (Free) or Google RECAPTCHA Enterprise must be enabled for form mailing.
Form Fields When Emailing From Your Site
The available merge tags are presented by clicking on the + icon next to each text field.
GIF Of Merge Tags in Email Form Settings
Mailto
When selecting Mailto, the email interface is simplified, and the user is presented with a simple mailto link on the frontend.
Akismet Protection
Akismet is a great spam protection tool, and if you have it installed, Highlight and Share will attempt to use it to protect you.
Simply enable or disable the Akismet option to use the service.
Akismet Provides an Additional Layer of Spam Protection
If you do not have Akismet installed or the API key for Akismet is disabled, you will see a warning indicating the status.
Google reCAPTCHA Enterprise
Enter the reCAPTCHA Enterprise credentials and test your email settings.
Sidebar Settings to Disable or Enable Social Sharing via a Highlight or Text Selection
Enable Highlight Sharing on Post Content, the Post Excerpt, and the Comments Section
Enable Text Selection on Mobile Devices
Setting a Sharing Prefix and Suffix
Suffix and Prefix Shown for Text Sharing
Shortlinks Option for Content Sharing
Shortlink Visible When Sharing Text
Configuring Image Sharing
You can customize the look and feel of how image sharing looks and behaves.
Navigate to the Highlight and Share admin settings, then click the Image Sharing tab.
Image Sharing Options in Highlight and Share
Enabling Image Sharing
Click "Enable Image Sharing" to allow Highlight and Share to show sharing icons on your post images.
Enable Image Sharing Option
Enable Pinterest Sharing
When enabled, a Pinterest icon will display on an image.
Enable Web Share Sharing
The allows for more native sharing and is typically only available on mobile devices or in supported browsers like Safari.
If on a supported browser or device, you'll see a "Share" option when hovering over an image.
On the user's mobile device, they can copy or share the image as they see fit.
Enable Only Image Sharing Using Web Share
Depending on your site, you may want to send only the image and not the URL where the image is located. This can be useful on tutorial sites or educational sites where users may want to copy the images for use in notes easily.
Airdropping and saving images: This option must be enabled to support Airdrop on Mac devices.
Exclude Leading Image
Sometimes, you have a featured image as the first image and want to skip that image. You can skip this "first" or leading image by checking the "Exclude Leading Image" option.
Select Which Post Types to Enable Image Sharing
You can select which post types have image sharing enabled by checking the enabled post types.
Sharing Preview
A sharing preview is shown periodically in the admin options to demonstrate what the sharing icons will look like when displayed on your site.
Sharing Location
By default, the sharing icons appear on the image's top-left.
Sharing locations can be:
Top Left
Top Right
Bottom Left
Bottom Right
Show on Hover (enabled or disabled)
By default, the sharing options display when hovering. If you'd like them always visible, switch this option off.
Set up Exclusions
Matching every image can be tricky, so that's why there are exclusions.
Think of exclusions as a way to filter out any images you don't want shared.
Enter a keyword, CSS class name, or data attribute, and the image is skipped if a match is found.
Setting the Button Labels
This section allows you to show or hide the button labels and customize them to match the wording on your site.
If you choose to hide the labels, only the icons will display.
Setting the Button Shape
Set the button shape, which can be:
Rounded
Circle
Square
The circular button shape is not recommended if the button labels are visible.
Choose rounded for a button with a slight border-radius.
You can also hide the labels and use the Rounded button shape.
Choose the Square button shape for a more traditional button appearance.
Choose the Circle button shape if you wish to display the icons only in a circular shape. Please note that the Circle button shape is only recommended if the labels are hidden.
Changing the Pinterest Colors
All colors for the Pinterest sharing icon and label can be customized.
Each color can be adjusted to match your site.
A live preview is beneath the color options to see the changes quickly.
Changing the Web Share Colors
All colors for the Web Share sharing icon and label can be customized.
You can use the color picker to match the button to your site.
Set up Exclusions to Match Keywords or CSS or Data Attributes
Show, Hide, and Customize the Button Labels
Hide the Sharing Button Labels to Show Icons Only
Set the Button Shape
Rounded Button Appearance with Labels
Rounded Button Appearance with Labels Hidden
Square Button Appearance
Circle Button Shape with Labels Hidden
Pinterest Color Options
Pinterest Color Picker Option
Web Share Color Options
Customize the Web Share Colors
Enabling Tracking Stats
Highlight and Share can be used to track stats for the social networks you interact with.
Overview
When a user shares content (via a social button or Web Share), the plugin can send a share event to your analytics stack. Stats are on by default; you can turn them off globally or restrict which data is sent for privacy.
Three channels receive the same event (when stats are enabled):
Channel
Purpose
If stats are disabled, nothing is pushed to any channel.
Event name
Context
Event name
Data sent (payload)
The event carries a small payload. By default, URL, share text, and title are not sent (they are sent as empty strings). Enable enhanced mode to include them.
dataLayer & CustomEvent (camelCase)
Field
When populated
Description
GA4 (gtag) — snake_case parameters
Parameter
When populated
Description
Synthetic events (CustomEvent)
The plugin dispatches a syntheticCustomEvent on window so your own scripts (or GTM custom HTML tags) can react to shares without relying on dataLayer or gtag.
What is sent
The event is dispatched as:
Event type:has:share
Target:window
Options:{ bubbles: true, cancelable: false }
Property
Type
Description
How to listen
Attach a listener to window for the event type has:share. Read the payload from event.detail.
The listener runs only when stats are enabled (has_stats_enabled / HAS_STATS_ENABLED). If stats are disabled, no CustomEvent is dispatched.
Constants
Define these in wp-config.php (or before the plugin runs) to set defaults. Filters can still override them.
HAS_STATS_ENABLED
Default: Stats are enabled (no constant = tracking on).
Use: Set to false to turn off all stats (dataLayer, gtag, and CustomEvent).
HAS_STATS_ENHANCED
Default: Enhanced data is off (no constant = URL, text, and title are not sent).
Use: Set to true to allow sending URL, share text, and title in the payload.
Filters
Use these in your theme or plugin to override the constants or implement conditional logic.
has_stats_enabled
Purpose: Turn stats on or off for the frontend.
Default passed: Value from HAS_STATS_ENABLED if defined, otherwise true.
Return:true
has_stats_enhanced
Purpose: Allow or disallow sending URL, share text, and title (privacy-sensitive fields).
Default passed: Value from HAS_STATS_ENHANCED if defined, otherwise false.
Return:true
Shortcode Parameters
You can enable the Click to Share box anywhere shortcodes are supported.
Click to Share Box
The Click to Share box can be enabled via shortcode. Here's a simple shortcode in use below:
It'll produce a default Click to Share box like shown below:
Default Appearance of Click to Share Shortcode
Here's a diagram of the various parts of the Click to Share box.
Diagram of Click to Share Box
Click to Share text - This is the text that will be shared with the social networks.
Click to Share button text - This is the text that is displayed for the Click to Share button.
Click to Share icon - The icon used for the Cilck to Share button.
Here are the shortcode arguments available for the Click to Share shortcode box.
unique_id
Use this to wrap a unique ID around the shortcode, otherwise it'll be random.
theme
Can be:
default (light appearance)
purple
blue
dark
align
Can be:
left
center (default)
right
show_click_to_share
Show the Click to Share section with text and an icon.
Can be:
true (default)
false
Example:
show_click_to_share_text
Show or hide the label in the Click to Share icon section.
Can be:
true (default)
false
Example:
show_icon
Show or hide the icon in the Click to Share icon section.
Can be:
true (default)
false
icon
Determine which sharing icon will be used in the Click to Share box.
Can be:
has-share-1
has-share-2
has-share-3
has-share-4
has-share-5
has-share-6
has-share-7
has-share-8
has-share-9
Example:
icon_size
Determine the icon size of the Click to Share icon section.
Can be:
small
medium (default)
large
Example:
custom_share_text
Input text that will be shared instead of the wrapped sharing text.
Example:
font_family
Choose the font family that will be used for the Click to Share shortcode.
Can be:
(or custom font family)
Example:
button_font_family
Choose the font family that will be used for the Click to Share button.
Can be:
(or custom font family)
Example:
click_text
This will change the Click to Share button text.
Example:
margin
Specify the margin that'll be used for the Click to Share shortcode. This will override a theme default.
Default: empty.
Example:
padding
Specify the padding that'll be used for the Click to Share shortcode. This will override a theme's default styles.
Example:
icon_color, icon_color_hover
Set the default color and hover color of the Click to Share icon.
Example:
text_color, text_color_hover
Set the default and hover color value of the main body text in the Click to Share box.
Example:
share_text_color, share_text_color_hover
Set the default and hover color of the sharing button.
Example:
background_color, background_color_hover
Set the default and hover background color of the Click to Share box.
Example:
font_size
The font size of the sharing text in the Click to Share box.
Can be:
small
medium (default)
large
Example:
click_share_font_size
The font size of the sharing button in the Click to Share box.
Can be:
small
medium (default)
large
Example:
border, border_hover
Set the CSS border of the Click to Share box in normal and hover state.
Example:
border_radius
Specify the CSS border radius of the Click to Share box.
Example:
max_width
The maximum width of the Click to Share box. Can be any valid CSS width.
Example:
Available Social Networks
This page goes over the available social networks in Highlight and Share
Highlight and Share does not load external social media scripts and styles.
The social networks included with Highlight and Share have sharing endpoints that are accessed directly. As a result, there are a minimal amount of resources that Highlight and Share needs.
The following social networks are supported by Highlight and Share.
[has_click_to_share]This is some text I'd like to share.[/has_click_to_share]
Always
Network or method, e.g. twitter, pinterest, webshare.
hasShareText
Enhanced only
Selected or shared text (privacy-sensitive).
hasSharePostUrl
Enhanced only
URL being shared (privacy-sensitive).
hasSharePostTitle
Enhanced only
Title of the content (privacy-sensitive).
Enhanced only
Same as hasShareText.
has_share_post_url
Enhanced only
Same as hasSharePostUrl.
has_share_post_title
Enhanced only
Same as hasSharePostTitle.
Payload: The same payload as dataLayer is in event.detail (camelCase). When enhanced is off, hasShareText, hasSharePostUrl, and hasSharePostTitle are empty strings.
string
Network/method, e.g. twitter, webshare.
event.detail.hasShareText
string
Share text (empty unless enhanced).
event.detail.hasSharePostUrl
string
Shared URL (empty unless enhanced).
event.detail.hasSharePostTitle
string
Content title (empty unless enhanced).
to enable,
false
to disable.
to send enhanced fields,
false
to send empty strings for them.
dataLayer
Google Tag Manager (and any GTM-based tags).
gtag
Google Analytics 4 when gtag() is present on the page.
window.addEventListener( 'has:share', function( event ) {
var payload = event.detail;
console.log( 'Share:', payload.hasSocialNetwork, payload.hasShareType );
// Optional: send to your own analytics or API.
} );
// With enhanced enabled, you can use URL, text, and title.
window.addEventListener( 'has:share', function( event ) {
var payload = event.detail;
if ( payload.hasSharePostUrl ) {
console.log( 'Shared URL:', payload.hasSharePostUrl );
}
} );
// In wp-config.php: disable all share tracking.
define( 'HAS_STATS_ENABLED', false );
// In wp-config.php: allow sending URL, share text, and title.
define( 'HAS_STATS_ENHANCED', true );
// Disable all stats (e.g. for EU unless consent given).
add_filter( 'has_stats_enabled', function( $enabled ) {
return false; // or your consent check.
} );
// Or use the helper.
add_filter( 'has_stats_enabled', '__return_false' );
// Enable only when a consent cookie is set.
add_filter( 'has_stats_enabled', function( $enabled ) {
return isset( $_COOKIE['analytics_consent'] ) && $_COOKIE['analytics_consent'] === 'yes';
} );
// Enable enhanced data (URL, text, title) when stats are on.
add_filter( 'has_stats_enhanced', '__return_true' );
// Enable enhanced only for logged-in admins (example).
add_filter( 'has_stats_enhanced', function( $enhanced ) {
return current_user_can( 'manage_options' );
} );
[has_click_to_share show_click_to_share="false"]This is some text I'd like to share.[/has_click_to_share]
[has_click_to_share show_click_to_share_text="false"]This is some text I'd like to share.[/has_click_to_share]
[has_click_to_share show_icon="false"]This is some text I'd like to share.[/has_click_to_share]
[has_click_to_share theme="purple" icon="has-share-9"]This is some text I'd like to share.[/has_click_to_share]
[has_click_to_share theme="pink" icon_size="large"]This is some text I'd like to share.[/has_click_to_share]
[has_click_to_share custom_share_text="Share this instead"]This is some text I'd like to share.[/has_click_to_share]
[has_click_to_share theme="purple" icon="has-share-9" font_family="Josefin Sans" button_font_family="Lato"]This is some text I'd like to share.[/has_click_to_share]
[has_click_to_share theme="purple" icon="has-share-9" font_family="Josefin Sans" button_font_family="Lato"]This is some text I'd like to share.[/has_click_to_share]
[has_click_to_share theme="purple" click_text="Share This!"]This is some text I'd like to share.[/has_click_to_share]
[has_click_to_share margin="20px auto"]This is some text I'd like to share.[/has_click_to_share]
[has_click_to_share theme="purple" padding="35px 45px"]This is some text I'd like to share.[/has_click_to_share]
[has_click_to_share theme="purple" icon_color="#f58220" icon_color_hover="#e76f1a"]This is some text I'd like to share.[/has_click_to_share]
[has_click_to_share theme="purple" text_color="#f58220" text_color_hover="#e76f1a"]This is some text I'd like to share.[/has_click_to_share]
[has_click_to_share theme="purple" share_text_color="#f58220" share_text_color_hover="#e76f1a"]This is some text I'd like to share.[/has_click_to_share]
[has_click_to_share theme="default" background_color="#dee2e6" background_color_hover="#FFFFFF"]This is some text I'd like to share.[/has_click_to_share]
[has_click_to_share theme="default" font_size="large"]This is some text I'd like to share.[/has_click_to_share]
[has_click_to_share theme="default" click_share_font_size="large"]This is some text I'd like to share.[/has_click_to_share]
[has_click_to_share theme="default" border="1px solid red" border_hover="1px solid black"]This is some text I'd like to share.[/has_click_to_share]
[has_click_to_share theme="default" border_radius="10px"]This is some text I'd like to share.[/has_click_to_share]
[has_click_to_share theme="default" max_width="550px" border_radius="10px"]This is some text I'd like to share.[/has_click_to_share]
Allows Text Sharing
Twitter
Yes
Facebook
No
Bluesky
Yes
Threads
Yes
Mastodon
Requesting New Social Networks
New social networks can absolutely be added to Highlight and Share. However, the sharing mechanism must have an endpoint (see below).
Endpoints Required: Highlight and Share does not load any third-party scripts from social networks. A publicly available endpoint is required.
Find Highlight and Share from the Settings Menu Item
Actions and Filters
Actions and Filters
Highlight and Share provides actions and filters so developers can customize behavior without editing plugin files. This document lists the hooks available in the plugin's PHP codebase.
Actions
has_enqueue_block_styles_scripts
Fires when the Click to Share block enqueues its styles and scripts in the block editor. Use this to enqueue your own block editor assets when the Highlight and Share block is in use.
Filters
has_social_network_defaults
Filter the default social networks array (labels, slugs, colors, share URL templates, etc.). Use this to add custom networks or modify built-in ones.
Example — modify the WhatsApp default (e.g. label, tooltip, or share URL):
has_show_{network_slug}
Determine whether a social network is shown. The filter name is dynamic: has_show_ + network slug (e.g. has_show_facebook, has_show_twitter, has_show_email). Built-in slugs include: facebook, twitter, linkedin, ok, vk, email, tumblr, copy
has_show_facebook
Hide or show the Facebook sharing option.
has_show_twitter
Hide or show the Twitter sharing option.
has_show_linkedin
Hide or show the LinkedIn sharing option.
has_show_ok
Hide or show the OK.ru sharing option.
has_show_vk
Hide or show the VK sharing option.
has_show_email
Hide or show the email sharing option.
has_show_tumblr
Hide or show the Tumblr sharing option.
has_show_copy
Hide or show the copy-to-clipboard option.
has_show_reddit
Hide or show the Reddit sharing option.
has_show_telegram
Hide or show the Telegram sharing option.
has_show_whatsapp
Hide or show the WhatsApp sharing option.
has_show_webshare
Hide or show the Web Share API option.
has_show_mastodon
Hide or show the Mastodon sharing option.
has_show_threads
Hide or show the Threads sharing option.
has_show_bluesky
Hide or show the BlueSky sharing option.
has_enable_content
Whether Highlight and Share runs on regular post or page content (e.g. inline highlighting and sharing).
has_enable_excerpt
Whether Highlight and Share runs on post excerpts.
has_highlight_sharing_enabled_for_post
Whether highlight-and-share (text selection sharing) is enabled for the current post.
has_headlines_enabled_for_post
Per-post override for headline sharing (sidebar share buttons on headings). Use to enable or disable headline sharing for specific posts.
has_headline_anchor_max_length
Purpose: Change the maximum character length used when truncating auto-generated headline anchors.
Parameters:
Parameter
Type
Description
Returns:int – The maximum length of characters to use for truncation.
Example: Use 60 characters instead of 45
Example: Disable truncation via filter (e.g., for a specific context)
Example: Longer limit for a specific post type
has_headline_anchor_truncated
Purpose: Modify the truncated slug after the plugin has shortened it (and stripped trailing dashes). Use this to apply custom logic or formatting to the final anchor.
Parameters:
Parameter
Type
Description
Returns:string – The slug to use as the heading ID. Must be non-empty; if empty, the plugin falls back to 'heading'.
Example: Add a prefix to truncated anchors only
has_footer_svg_sprite
Replace or add SVG sprite markup output in the footer (used for headline share panel icons when the main HAS container may not be present).
has_headline_share_url_template
Modify the share URL template for a given network in the headline sharing panel (e.g. Twitter, LinkedIn). Placeholders like %url% and %title% are replaced by the front-end script.
Example — use a custom share URL for WhatsApp in the headline sharing panel (placeholders such as %url% and %title% are replaced by the front-end script):
has_pin_show_on_archives
Whether image (pin) sharing is shown on archive and blog index pages.
has_pin_supported_post_types
List of post type slugs where image (pin) sharing is supported. Modify to add or remove post types.
has_image_sharing_enabled_for_post
Whether image sharing (pin/share on images) is enabled for a specific post.
has_pin_image_css_classes
CSS classes applied to the image sharing wrapper (e.g. position, show-on-hover). Add or remove classes.
has_pin_core_exclusions
CSS classes or identifiers that exclude an image from getting the pin/image sharing wrapper. Images (or their parents) containing these strings are skipped. Default includes has-no-pin.
has_pin_excerpt_exclusions
Same as has_pin_core_exclusions but applied only when processing excerpts. Use to add or remove excerpt-specific exclusions.
has_pin_show_on_excerpts
Whether image sharing is applied to post excerpts. Default true.
has_enable_image_sharing_on_singular_featured
Allow image sharing on featured images (post thumbnails) on singular posts/pages. Default false to avoid large hero images with sharing buttons.
/**
* Filter: has_enable_content
*
* @param bool $enable True to enable HAS on post content, false to disable.
*/
add_filter( 'has_enable_content', function( $enable ) {
return $enable;
} );
/**
* Filter: has_enable_excerpt
*
* @param bool $enable True to enable HAS on excerpts, false to disable.
*/
add_filter( 'has_enable_excerpt', function( $enable ) {
return $enable;
} );
/**
* Filter: has_highlight_sharing_enabled_for_post
*
* @param bool $enabled Whether highlight sharing is enabled for the post.
* @param int $post_id The current post ID.
* @since 7.0.0
*/
add_filter( 'has_highlight_sharing_enabled_for_post', function( $enabled, $post_id ) {
return $enabled;
}, 10, 2 );
/**
* Filter: has_headlines_enabled_for_post
*
* @param bool $global_enabled Global headlines enabled state for this context.
* @param int $post_id Current post ID.
* @return bool Whether headlines should run for this post.
*/
add_filter( 'has_headlines_enabled_for_post', function( $global_enabled, $post_id ) {
return $global_enabled;
}, 10, 2 );
add_filter( 'has_headline_anchor_max_length', function ( $max_length ) {
// Only truncate on single posts; use full length elsewhere.
if ( ! is_singular( 'post' ) ) {
return 0;
}
return 45;
} );
/**
* Filter: has_pin_show_on_archives
*
* @param bool $show Whether to show image sharing on archives. Default true.
* @param string $post_type The post type (from get_post_type()).
*/
add_filter( 'has_pin_show_on_archives', function( $show, $post_type ) {
return $show;
}, 10, 2 );
/**
* Filter: has_pin_supported_post_types
*
* @param array $supported_slugs Array of post type slugs (e.g. post, page).
*/
add_filter( 'has_pin_supported_post_types', function( $supported_slugs ) {
return $supported_slugs;
} );
/**
* Filter: has_image_sharing_enabled_for_post
*
* @param bool $global_enabled Global enabled state from settings and post type.
* @param int $post_id The post ID.
*/
add_filter( 'has_image_sharing_enabled_for_post', function( $global_enabled, $post_id ) {
return $global_enabled;
}, 10, 2 );
/**
* Filter: has_pin_show_on_excerpts
*
* @param bool $show Whether to show image sharing on excerpts. Default true.
*/
add_filter( 'has_pin_show_on_excerpts', function( $show ) {
return $show;
} );
/**
* Filter: has_enable_image_sharing_on_singular_featured
*
* @param bool $enable True to show sharing on singular featured images.
* @since 7.0.0
*/
add_filter( 'has_enable_image_sharing_on_singular_featured', function( $enable ) {
return $enable;
} );
Styling Highlight and Share
This guide explains how to customize the look of Highlight and Share: first using the built-in settings (no code), then using CSS variables and custom CSS for deeper control.
Overriding styles with CSS
Highlight and Share uses CSS custom properties (variables) where possible. You can override them in your theme’s stylesheet, in Appearance → Customize → Additional CSS, or in a child theme.
How it works: The plugin sets variables (e.g. --has-pinterest-button-color). Its own CSS uses those variables. If you redefine the same variable in a more specific selector (e.g. :root or a wrapper), your value wins. That way you don’t have to copy large blocks of CSS—just set the variables you want to change.
CSS variables reference
Inline highlight (selected text)
When users select text and see the yellow highlight (and optional tooltip), these variables control only the tooltip. The highlight background and text colors are set by the plugin from settings; to override them, use the class overrides in the next section.
Variable
Default
What it changes
Example — different tooltip style:
Image (Pin) sharing buttons
These apply to the Pinterest and Web Share buttons on images (content, excerpts, featured images).
Variable
Default
What it changes
Example — match your brand:
Headline sharing panel
The small panel that opens when users click the share icon next to a heading.
Variable
Default
What it changes
Example — dark panel:
Click to Share block (CTA)
The Click to Share block outputs variables on the block wrapper. You can override them by targeting the block’s container (e.g. .wp-block-dlxplugins-has-click-to-share or the block’s uniqueId class).
Variable
What it changes
Example — override CTA colors for all Click to Share blocks:
If there’s no variable for what you want to change, you can target the plugin’s classes directly. Use Appearance → Customize → Additional CSS or your theme’s CSS.
Main wrappers and layout
Class
Where it appears
Purpose
Inline highlight (selected text)
Class
Purpose
Example — change inline highlight colors without variables:
The plugin injects inline styles for highlight colors from settings. To force your own colors, override with !important or a more specific selector:
Image (Pin) sharing
Class
Purpose
Headline sharing
Class / attribute
Purpose
Creating a simple “theme” with CSS variables
You can define a small set of variables in one place and reuse them across the plugin’s features.
Example — one dark palette for HAS:
Put this in Appearance → Customize → Additional CSS
Scoping overrides (e.g., one page or one block)
To change styles only in certain places:
Only on posts: Use body.single .highlight-and-share-wrapper { ... } or body.post-type-post :root { ... } (variables on :root will still apply globally unless you set them on a closer ancestor.
Only for the Click to Share block: Target .wp-block-dlxplugins-has-click-to-share and set the --has-cta-* variables on that wrapper.
Example — different image button colors only in the sidebar:
#FFFFFF
Pinterest icon color.
--has-pinterest-icon-color-hover
#FFFFFF
Pinterest icon hover.
--has-pinterest-text-color
#FFFFFF
Pinterest label text.
--has-pinterest-text-color-hover
#FFFFFF
Pinterest label hover.
--has-webshare-button-color
#f58f2f
Web Share button background.
--has-webshare-button-color-hover
#e17713
Web Share button hover.
--has-webshare-icon-color
#FFFFFF
Web Share icon.
--has-webshare-icon-color-hover
#FFFFFF
Web Share icon hover.
--has-webshare-text-color
#FFFFFF
Web Share label text.
--has-webshare-text-color-hover
#FFFFFF
Web Share label hover.
#1e1e1e
Row text color.
--has-cta-cta-text-color
“Share” / CTA text color.
--has-cta-cta-text-color-hover
CTA text hover.
--has-cta-icon-color
Icon color.
--has-cta-icon-color-hover
Icon hover.
--has-cta-border-color
Border color.
--has-cta-border-color-hover
Border hover.
--has-cta-maximum-width
Max width of the block.
--has-cta-inner-padding
Inner padding.
--has-cta-outer-margin
Outer margin.
--has-cta-border-width
Border width.
--has-cta-border-radius
Border radius.
--has-cta-quote-font-family
Quote font.
--has-cta-quote-font-size
Quote font size.
--has-cta-quote-font-weight
Quote font weight.
--has-cta-quote-line-height
Quote line height.
--has-cta-quote-letter-spacing
Quote letter spacing.
--has-cta-quote-text-transform
Quote text transform.
--has-cta-cta-font-family
CTA font.
--has-cta-cta-font-size
CTA font size.
--has-cta-cta-font-weight
CTA font weight.
--has-cta-cta-line-height
CTA line height.
--has-cta-cta-letter-spacing
CTA letter spacing.
--has-cta-cta-text-transform
CTA text transform.
Same
Icons in a column.
.theme-default
Same
Default theme.
.theme-brand-colors
Same
Brand colors (icons only).
.theme-black, .theme-white, etc.
Same
Other built-in themes.
.hide-has-labels
Same
Labels visually hidden (still for screen readers).
Only for image sharing: Target .has-pin-image-wrapper and set the --has-pinterest-* and --has-webshare-* variables on that wrapper (they inherit from :root by default).