SocialShare Pro
A comprehensive social media sharing plugin with floating buttons, inline sharing, and auto-posting capabilities.
by Your Name · github.com/bkkalana/socialshare-pro · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/bkkalana/socialshare-pro/archive/refs/heads/main.zipA comprehensive WordPress plugin for social media sharing with floating buttons, inline sharing, and auto-posting capabilities. Built with robust compatibility and security features.
Features
Core Features
- Floating Social Share Bar - Sticky floating buttons that appear on the side of your pages
- Inline Share Buttons - Automatically add share buttons before/after post content
- Shortcode Support - Manual placement with
[socialshare_pro]shortcode - Multiple Social Networks - Facebook, Twitter (X), LinkedIn, WhatsApp, and Email
- Auto-Posting - Automatically share new posts to connected social media accounts
- Customizable Styling - Modern, responsive design with customization options
- Admin Settings Panel - Easy configuration through WordPress admin
- Robust Compatibility - Enhanced error handling and WordPress function fallbacks
- Security Features - Comprehensive sanitization, validation, and nonce protection
Supported Social Networks
- Twitter (X)
Installation
Requirements
- WordPress 5.0 or higher
- PHP 7.4 or higher
- MySQL 5.6 or higher
Installation Steps
- Upload the
socialshare-profolder to your/wp-content/plugins/directory - Activate the plugin through the 'Plugins' menu in WordPress
- Go to Settings > SocialShare Pro to configure your preferences
Compatibility
- WordPress: 5.0+ (tested up to 6.4)
- PHP: 7.4+ (with fallbacks for older functions)
- Multisite: Supported
- WooCommerce: Compatible
- Page Builders: Compatible with most popular page builders
Configuration
General Settings
- Enable Floating Bar - Toggle the floating social share bar on/off
- Inline Button Position - Choose where to display inline buttons:
- Before content
- After content
- Both before and after
Social Networks
Enable or disable specific social networks:
- Twitter (X)
Auto Post Settings
Configure automatic posting to social media when new posts are published:
- Enable Auto Posting - Toggle automatic posting on/off
- Facebook Access Token - Your Facebook Page Access Token
- Twitter Access Token - Your Twitter Bearer Token
- LinkedIn Access Token - Your LinkedIn Access Token
Usage
Shortcode
Use the [socialshare_pro] shortcode to display social share buttons anywhere:
[socialshare_pro]
Shortcode Attributes
networks- Comma-separated list of networks to display (e.g., "facebook,twitter,linkedin")style- Button style: "inline" (default), "minimal"show_labels- Show/hide button labels: "true" (default), "false"size- Button size: "small", "medium" (default), "large"
Examples:
[socialshare_pro networks="facebook,twitter" style="minimal" size="large"]
[socialshare_pro networks="whatsapp,email" show_labels="false"]
Automatic Display
The plugin automatically adds share buttons to your posts based on your settings:
- Inline buttons appear before/after post content
- Floating bar appears on the side of the page after scrolling
Customization
CSS Customization
You can customize the appearance by adding CSS to your theme or child theme. The buttons use the following CSS classes:
/* Inline buttons */
.ssp-share-buttons.ssp-inline { /* Container */ }
.ssp-share-button { /* Individual button */ }
.ssp-share-button.ssp-facebook { /* Facebook button */ }
.ssp-share-button.ssp-twitter { /* Twitter button */ }
.ssp-share-button.ssp-linkedin { /* LinkedIn button */ }
.ssp-share-button.ssp-whatsapp { /* WhatsApp button */ }
.ssp-share-button.ssp-email { /* Email button */ }
/* Floating bar */
.ssp-floating-bar { /* Floating container */ }
.ssp-floating-button { /* Floating button */ }
/* Shortcode buttons */
.ssp-share-buttons.ssp-shortcode { /* Shortcode container */ }
Hooks and Filters
The plugin provides several hooks for developers:
// Filter enabled networks
add_filter('ssp_enabled_networks', function($networks) {
// Modify $networks array
return $networks;
});
// Filter share URL
add_filter('ssp_share_url', function($url, $network, $post_id) {
// Modify share URL
return $url;
}, 10, 3);
// Filter button HTML
add_filter('ssp_button_html', function($html, $network, $post_id) {
// Modify button HTML
return $html;
}, 10, 3);
API Integration
To enable auto-posting to Facebook:
- Go to Facebook Developers
- Create a new app or use an existing one
- Generate a Page Access Token
- Add the token to the plugin settings
To enable auto-posting to Twitter:
- Go to Twitter Developer Portal
- Create a new app or use an existing one
- Generate a Bearer Token
- Add the token to the plugin settings
To enable auto-posting to LinkedIn:
- Go to LinkedIn Developers
- Create a new app
- Generate an Access Token
- Add the token to the plugin settings
Security
The plugin implements comprehensive security measures:
- Input Sanitization: All user inputs are sanitized using WordPress functions
- Output Escaping: All output is properly escaped to prevent XSS attacks
- Nonce Protection: All form submissions are protected with WordPress nonces
- Capability Checks: Admin functions require proper user capabilities
- SQL Injection Prevention: All database queries use prepared statements
- CSRF Protection: Cross-site request forgery protection on all forms
- Data Validation: Strict validation of all configuration options
- Function Existence Checks: Robust error handling for missing WordPress functions
Performance
- Optimized Assets: Minified CSS and JavaScript files
- Lazy Loading: Images and non-critical resources load on demand
- Database Optimization: Minimal database queries with efficient caching
- Settings Caching: Plugin settings are cached to reduce database calls
- Responsive Design: Mobile-first approach with optimized loading
- WordPress Compatibility: Enhanced function fallbacks prevent fatal errors
- Memory Efficient: Optimized code structure for minimal memory usage
Browser Support
- Chrome 60+
- Firefox 55+
- Safari 12+
- Edge 79+
- Internet Explorer 11 (limited support)
Troubleshooting
Common Issues
-
Buttons not appearing
- Check if the plugin is activated
- Verify network settings in admin
- Clear any caching plugins
- Check for JavaScript errors in browser console
-
Auto-posting not working
- Verify access tokens are correct and not expired
- Check if auto-posting is enabled in settings
- Review error logs for API errors
- Ensure WP Cron is working properly
-
Styling issues
- Check for theme conflicts
- Verify CSS is loading correctly
- Use browser developer tools to inspect elements
- Check for CSS specificity conflicts
-
Plugin activation errors
- Ensure PHP version meets requirements (7.4+)
- Check for plugin conflicts
- Review WordPress error logs
- Verify file permissions
Debug Mode
Enable WordPress debug mode to see detailed error messages:
// wp-config.php
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
Error Logs
Check the following locations for error logs:
/wp-content/debug.log(WordPress debug log)- Server error logs (varies by hosting provider)
- Browser console for JavaScript errors
Changelog
Version 1.0.1
- Enhanced Compatibility: Added comprehensive WordPress function fallbacks
- Improved Error Handling: Better error handling for missing WordPress functions
- Security Enhancements: Enhanced input sanitization and output escaping
- Performance Optimizations: Improved loading and memory usage
- Bug Fixes: Fixed syntax errors and compatibility issues
Version 1.0.0
- Initial release
- Floating social share bar
- Inline share buttons
- Shortcode support
- Auto-posting functionality
- Admin settings panel
- Responsive design
- Basic security features
Technical Details
Plugin Architecture
The plugin follows WordPress coding standards and best practices:
- Object-Oriented Design: Clean, modular class structure
- WordPress Hooks: Extensive use of actions and filters
- Settings API: Native WordPress Settings API integration
- Database Layer: Custom database class for data management
- AJAX Handling: Secure AJAX endpoints for dynamic functionality
- Cron Integration: WP Cron for scheduled auto-posting
File Structure
socialshare-pro/
├── socialshare-pro.php # Main plugin file
├── includes/
│ ├── class-admin.php # Admin interface
│ ├── class-frontend.php # Frontend display
│ ├── class-shortcode.php # Shortcode functionality
│ ├── class-settings.php # Settings management
│ ├── class-auto-post.php # Auto-posting features
│ ├── class-ajax.php # AJAX handlers
│ └── class-database.php # Database operations
├── assets/
│ ├── css/ # Stylesheets
│ └── js/ # JavaScript files
├── languages/ # Translation files
└── screenshots/ # Plugin screenshots
Compatibility Features
- Function Existence Checks: All WordPress functions are checked before use
- Graceful Degradation: Plugin continues to work even if some functions are missing
- Error Prevention: Comprehensive error handling prevents fatal errors
- Backward Compatibility: Works with older WordPress versions
Support
For support and feature requests, please contact the plugin developer or create an issue in the plugin repository.
License
This plugin is licensed under the GPL v2 or later.
Credits
- Social media icons from various sources
- WordPress Settings API
- jQuery for frontend functionality
- WordPress hooks and filters system
- Enhanced compatibility improvements