Skip to content

Enhancement: Add WordPress Integration β€” demo page section and CDN usage guideΒ #52

@coderabbitai

Description

@coderabbitai

🎯 Direction

SocialShareButton is a lightweight, zero-dependency, framework-agnostic social sharing component. WordPress powers over 40% of the web β€” it is the single largest platform where a social share button can add value. Integration is entirely CDN-based via wp_enqueue_style, wp_enqueue_script, and a small wp_footer hook. No separate wrapper file is needed.

πŸ“Ή See the button in action: https://youtu.be/cLJaT-8rEvQ?si=CLipA0Db4WL0EqKM


πŸ“ Files to Create / Modify

ℹ️ No New Wrapper File Needed

WordPress integration is done in a theme's functions.php using standard WordPress enqueueing APIs and a footer hook. No JavaScript framework wrapper is required.


βœ… Existing File: index.html β€” Add WordPress Integration Section

Add a new section with:

  • Section heading: πŸ”· WordPress Integration
  • Step 1: Enqueue the CSS and JS in functions.php
  • Step 2: Initialize the button in the footer

functions.php:

function enqueue_social_share_button() {
    wp_enqueue_style(
        'social-share-button',
        'https://cdn.jsdelivr.net/npm/social-share-button/dist/social-share-button.css'
    );
    wp_enqueue_script(
        'social-share-button',
        'https://cdn.jsdelivr.net/npm/social-share-button/dist/social-share-button.js',
        [],
        null,
        true // Load in footer
    );
}
add_action('wp_enqueue_scripts', 'enqueue_social_share_button');

function init_social_share_button() { ?>
    <div id="share-button"></div>
    <script>
      new SocialShareButton({
        container: '#share-button',
        url: window.location.href,
        title: document.title,
        theme: 'dark',
        buttonText: 'Share'
      });
    </script>
<?php }
add_action('wp_footer', 'init_social_share_button');

βœ… Acceptance Criteria

  • No new wrapper file required β€” integration is PHP/CDN only via WordPress hooks
  • index.html updated with a WordPress section containing functions.php code snippet
  • Copy-to-clipboard button present on new code blocks in index.html
  • README updated to list WordPress as a supported integration pattern

⚠️ Planned β€” Not Final
This issue represents a planned enhancement and is not guaranteed to be implemented. It may be dropped if it does not align with the repository's direction. Before opening a pull request, please discuss with the maintainers in this issue thread.

Metadata

Metadata

Assignees

No one assigned

    Labels

    plannedPlanned feature - not final, may be dropped based on repo direction

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions