A WordPress plugin that adds a Gutenberg block to copy and share the current post URL in one click.
Blockparty Post Sharing is a WordPress plugin that lets editors add sharing actions to posts via the block editor. Visitors can copy the article link to the clipboard or open the native share sheet of their device when supported.
- Native Gutenberg block: Full integration with the WordPress block editor
- Copy link: Copies the current post permalink to the clipboard with visual and screen reader feedback
- Native share: Uses the Web Share API when available
- Editable labels: Customize button text inline with
RichText - Copied state label: Configure the label shown after a successful copy
- Icons: Default icons rendered with CSS
mask-image, overridable via CSS custom properties - Icon settings: Show or hide icons and position them left or right
- Responsive display: Show or hide each button independently on desktop and mobile
- Dynamic rendering: Server-side output with post URL and title context
- Internationalized: Multilingual support with translation files
- View script: Frontend script handles copy, share, and copied-state UI
- WordPress: Version 6.8 or higher
- PHP: Version 8.1 or higher
- PHP Extension: ext-json
composer require beapi/blockparty-post-sharing- Download the latest version of the plugin
- Extract the archive to the
/wp-content/plugins/folder - Activate the plugin from the WordPress "Plugins" menu
# Clone the repository
git clone https://github.com/BeAPI/blockparty-post-sharing.git
cd blockparty-post-sharing
# Install PHP dependencies
composer install
# Install JavaScript dependencies
npm install
# Build the assets
npm run build- Open the Gutenberg block editor on a post
- Add a Post Sharing Button block (search for "Post Sharing" in the Widgets category)
- Customize the block:
- Copy link and Share button labels directly in the editor
- Display: choose desktop or mobile viewport and toggle each button visibility
- Copy Button: set the label displayed after the link is copied
- Icon: show or hide icons and choose left or right position
- On the frontend:
- Copy link copies the current post URL
- Share opens the native share dialog when the browser supports it
The desktop/mobile breakpoint defaults to 600px. Themes and plugins can override it with:
add_filter( 'blockparty_post_sharing_breakpoint', function () {
return 782;
} );- Filter name:
blockparty_post_sharing_breakpoint - Parameters:
intβ Breakpoint width in pixels. - Default:
600
Default icons are exposed as CSS custom properties on .wp-block-blockparty-post-sharing-button:
.wp-block-blockparty-post-sharing-button {
--wp-block-blockparty-post-sharing-button-copy-icon: url( '/path/to/link.svg' );
--wp-block-blockparty-post-sharing-button-share-icon: url( '/path/to/share.svg' );
--wp-block-blockparty-post-sharing-button-check-icon: url( '/path/to/check.svg' );
--wp-block-blockparty-post-sharing-button-icon-size: 1.25rem;
--wp-block-blockparty-post-sharing-button-icon-color: currentColor;
}blockparty-post-sharing/
βββ src/ # Block sources
β βββ blockparty-post-sharing/
β βββ block.json # Block configuration
β βββ edit.js # Edit component
β βββ index.js # Entry point
β βββ view.js # Frontend copy/share logic
β βββ img/ # Default SVG icons
β βββ editor.scss # Editor styles
β βββ style.scss # Frontend and editor styles
βββ includes/ # PHP classes
β βββ BlockRenderer.php # Dynamic block rendering
β βββ ResponsiveDisplay.php # Responsive visibility rules
βββ build/ # Compiled assets (blocks-manifest.php, etc.)
βββ languages/ # Translation files
βββ .wordpress-org/blueprints/ # WordPress Playground blueprint
βββ blockparty-post-sharing.php # Main plugin file
βββ composer.json # PHP dependencies
βββ package.json # JavaScript dependencies
# Development with hot reload
npm start
# Production build
npm run build
# JavaScript linter
npm run lint:js
# CSS linter
npm run lint:css
# Code formatting
npm run format
# Generate POT file
npm run make-pot
# Generate JSON translation files
npm run make-json
# Create plugin ZIP archive
npm run plugin-zip
# Start local development environment
npm run start:env
# Stop local development environment
npm run stop:env# Check code with PHP_CodeSniffer
composer cs
# Automatically fix code
composer cb
# Run unit tests
composer phpunitThe project follows WordPress coding standards:
- WPCS (WordPress Coding Standards) for PHP
- ESLint with WordPress rules for JavaScript
- GrumPHP to automate pre-commit checks
The plugin uses @wordpress/env to create a local WordPress development environment:
# Start the environment
npm run start:env
# Access WordPress
# URL: http://localhost:8888
# Default credentials: admin / password
# Stop the environment
npm run stop:envThe project integrates several quality tools:
- PHP_CodeSniffer: PHP coding standards verification
- PHPCompatibility: PHP compatibility verification
- PHP Parallel Lint: PHP syntax error detection
- GrumPHP: Pre-commit checks automation
The plugin is fully internationalized (text domain: blockparty-post-sharing). Translation files are available in the languages/ folder.
- English (default)
- French (when translation files are provided)
- Use the
languages/blockparty-post-sharing.potfile as a base - Create your
.poand.mofiles - Place them in the
languages/folder
Contributions are welcome! To contribute:
- Fork the project
- Create a branch for your feature (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Make sure your code:
- Follows WordPress coding standards
- Passes all quality tests (PHPCS, ESLint)
- Is properly documented
- Includes translations if necessary
This plugin is distributed under the GPL-2.0-or-later license.
Be API Technical Team
- Email: technical@beapi.fr
- Website: https://beapi.fr
- WordPress Block Editor Documentation
- WordPress Coding Standards
- Block API Reference
- Web Share API (MDN)
See readme.txt for the full version history. Recent highlights:
- 1.0.0
- Initial release with copy and share buttons, editable labels, icons, responsive display settings, and WordPress Playground blueprint.
Developed with β€οΈ by Be API