Guide

Social Share Text Link

Block Overview

PropertyValue
Nameprc-block/social-share-text-link
TitleSocial Share Text Link
Categorywidgets
Version1.0.0
DescriptionAdd a text link to a social share group.

Supports

FeatureEnabled
HTML editingNo
AnchorYes
AlignmentNo
SpacingblockGap, margin (top/bottom), padding
TypographyfontSize, fontFamily

Attributes

AttributeTypeDefaultDescription
labelstring(none)The visible text of the link.
opensInNewTabbooleanfalseWhether the link opens in a new browser tab.
urlstring(none)The URL the link points to.

Uses Context

Context KeyDescription
openInNewTabWhether links open in a new tab.
showLabelsWhether to show labels on social links.
iconColorColor slug for the icon/text color.
iconColorValueHex color value for the icon/text.
iconBackgroundColorColor slug for the background.
iconBackgroundColorValueHex color value for the background.

Available Styles

None defined.

Inner Blocks

This block does not accept inner blocks.

Parent / Ancestor Requirements

Required parent: core/social-links

This block must be placed inside a Social Links block.

Usage Instructions

  1. Insert a Social Links (core/social-links) block.
  2. Add the Social Share Text Link block as a child.
  3. Type the link text directly in the block using the inline RichText editor (supports bold formatting).
  4. Use Cmd+K (Mac) or Ctrl+K (Windows) or the link toolbar button to set the URL.
  5. The link will inherit icon color and background color from the parent Social Links block.
  6. If no label is set, the block will not render on the frontend.

Example

From block.json:

{
  "attributes": {
    "label": "Read more..."
  }
}

Block Markup Example

<a class="wp-block-prc-block-social-share-text-link has-white-color"
   href="https://example.com/article"
   rel="nofollow"
   target="_blank">
  Read more...
</a>

PHP Rendering

The block is server-side rendered via Social_Share_Text_Link::render_callback():

  • Returns empty string if no label is set or if the block object is invalid.
  • Reads iconColor and iconBackgroundColor from context and applies them as CSS classes.
  • Renders as an <a> tag with:
    • href from the url attribute.
    • rel="nofollow" always set.
    • target="_blank" if opensInNewTab is true.
  • The label content is sanitized via wp_kses(), allowing code, em, img, s, span, strong tags.

Frontend Interactivity

No view script. This is a static rendered link.

  • core/social-links — Parent block providing context for colors and layout.
  • prc-block/social-share-sheet — Another social sharing child block for native share sheet.
  • prc-block/social-share-url-field — Provides a copyable URL field within social links.

Was this helpful?