API Overview
The LionWP API provides programmatic access to all plugin functionality across our entire ecosystem. All public methods are designed to be safe, efficient, and well-documented with consistent patterns.
Lion Social Share v1.0.4
Social sharing functionality with 35+ platforms and comprehensive API
Lion GDPR Coming Soon
Complete GDPR compliance with consent management API
Lion Under Construction Coming Soon
Maintenance pages with email collection and launch management
Universal API Pattern
// Check if any LionWP plugins are active
$active_plugins = lionwp_get_active_plugins();
foreach ($active_plugins as $plugin => $version) {
echo "LionWP {$plugin} v{$version} is active\n";
}
// Universal function pattern for all plugins
if (class_exists('LionWP_Social_Share')) {
echo lionwp_social_share_buttons();
}
if (class_exists('LionWP_GDPR')) {
echo lionwp_gdpr_consent_notice();
}
if (class_exists('LionWP_Construction')) {
lionwp_enable_construction_mode();
}
Global Functions
These functions are available globally when the respective LionWP plugins are activated.
Social Share Functions
| Parameter | Type | Required | Description |
|---|---|---|---|
| $args | array | Optional | Configuration array for display and behavior options |
Available Arguments:
| Key | Type | Default | Description |
|---|---|---|---|
| platforms | array | null | Array of platform names to display |
| style | string | 'style-1' | Button style (style-1 through style-10) |
| size | string | 'medium' | Button size (small, medium, large) |
| url | string | current URL | URL to share |
| title | string | current title | Title to share |
| show_labels | boolean | true | Whether to show platform labels |
// Basic usage - displays default social buttons
echo lionwp_social_share_buttons();
// Custom platforms and style
echo lionwp_social_share_buttons(array(
'platforms' => array('facebook', 'twitter', 'linkedin', 'email'),
'style' => 'style-5',
'size' => 'large',
'show_labels' => false
));
// Custom URL and title for specific content
echo lionwp_social_share_buttons(array(
'url' => 'https://example.com/special-page',
'title' => 'Check out this amazing content!',
'platforms' => array('facebook', 'twitter', 'pinterest')
));
// Integration with WordPress loop
while (have_posts()) {
the_post();
echo lionwp_social_share_buttons(array(
'url' => get_permalink(),
'title' => get_the_title(),
'style' => 'style-' . get_post_meta(get_the_ID(), 'share_style', true)
));
}
| Parameter | Type | Required | Description |
|---|---|---|---|
| $platform | string | Required | Platform identifier (facebook, twitter, linkedin, etc.) |
| $url | string | Required | URL to share |
| $title | string | Optional | Title for the share |
| $description | string | Optional | Description for platforms that support it |
// Get Facebook share URL
$facebook_url = lionwp_get_share_url(
'facebook',
'https://example.com/my-article',
'Amazing Article Title'
);
// Get Twitter share URL with description
$twitter_url = lionwp_get_share_url(
'twitter',
'https://example.com/my-article',
'Check out this amazing article!',
'Full article description here'
);
// Build custom sharing links
$platforms = array('facebook', 'twitter', 'linkedin', 'email');
foreach ($platforms as $platform) {
$share_url = lionwp_get_share_url($platform, get_permalink(), get_the_title());
if ($share_url) {
echo "<a href='{$share_url}' target='_blank'>Share on " . ucfirst($platform) . "</a>";
}
}
// Use in custom buttons with error handling
$pinterest_url = lionwp_get_share_url('pinterest', $url, $title, $description);
if ($pinterest_url) {
echo "<a href='{$pinterest_url}' class='pinterest-share'>Pin It</a>";
} else {
echo "<span class='share-unavailable'>Pinterest sharing not available</span>";
}
GDPR Functions (Coming Soon)
// Basic GDPR consent notice
if (class_exists('LionWP_GDPR')) {
echo lionwp_gdpr_consent_notice();
// Custom notice with specific consent types
echo lionwp_gdpr_consent_notice(array(
'types' => array('essential', 'analytics', 'marketing'),
'position' => 'bottom',
'style' => 'dark',
'auto_hide' => true
));
// Check if user has given consent
if (lionwp_check_gdpr_consent('analytics')) {
// Load analytics scripts
wp_enqueue_script('google-analytics');
}
// Get user consent status
$consent_data = lionwp_get_gdpr_consent_data();
foreach ($consent_data as $type => $granted) {
if ($granted) {
echo "User has consented to: {$type}\n";
}
}
}
// Check different types of consent
if (lionwp_check_gdpr_consent('analytics')) {
// User has consented to analytics
gtag('config', 'GA_MEASUREMENT_ID');
}
if (lionwp_check_gdpr_consent('marketing')) {
// User has consented to marketing
load_facebook_pixel();
}
if (lionwp_check_gdpr_consent('functional')) {
// User has consented to functional cookies
enable_chat_widget();
}
// Conditional content based on consent
function show_personalized_content() {
if (lionwp_check_gdpr_consent('personalization')) {
return get_user_personalized_content();
} else {
return get_generic_content();
}
}
Under Construction Functions (Coming Soon)
// Enable construction mode with custom settings
if (class_exists('LionWP_Construction')) {
lionwp_enable_construction_mode(array(
'template' => 'modern',
'launch_date' => '2025-12-31 12:00:00',
'collect_emails' => true,
'social_links' => true,
'bypass_roles' => array('administrator', 'editor'),
'custom_message' => 'We are working hard to bring you something amazing!'
));
// Add email to launch notification list
lionwp_add_launch_notification('user@example.com', 'John Doe');
// Check if construction mode is active
if (lionwp_is_construction_active()) {
// Show admin notice
add_action('admin_notices', function() {
echo '<div class="notice notice-warning">Construction mode is active</div>';
});
}
// Get email subscribers count
$subscriber_count = lionwp_get_construction_subscribers_count();
echo "We have {$subscriber_count} people waiting for launch!";
}
Universal Helper Functions
These helper functions work across all LionWP plugins and provide universal functionality.
// Get all active LionWP plugins
$active_plugins = lionwp_get_active_plugins();
// Display active plugins
foreach ($active_plugins as $plugin => $version) {
echo "LionWP {$plugin} v{$version} is active\n";
}
// Check for specific plugin
if (isset($active_plugins['social_share'])) {
echo "Social Share plugin v" . $active_plugins['social_share'] . " is active";
}
// Conditional functionality based on active plugins
if (count($active_plugins) > 0) {
echo "LionWP plugins detected: " . implode(', ', array_keys($active_plugins));
// Enable universal features
add_action('wp_footer', 'add_lionwp_universal_scripts');
}
| Parameter | Type | Required | Description |
|---|---|---|---|
| $plugin_name | string | Required | Plugin identifier (social_share, gdpr, construction, etc.) |
// Check for specific plugins
if (lionwp_is_plugin_active('social_share')) {
// Social Share plugin is active
echo lionwp_social_share_buttons();
}
if (lionwp_is_plugin_active('gdpr')) {
// GDPR plugin is active
echo lionwp_gdpr_consent_notice();
}
if (lionwp_is_plugin_active('construction')) {
// Under Construction plugin is active
if (!current_user_can('administrator')) {
lionwp_show_construction_page();
}
}
// Build dynamic navigation based on active plugins
function build_lionwp_admin_menu() {
$menu_items = array();
if (lionwp_is_plugin_active('social_share')) {
$menu_items[] = '<a href="/admin/social-share">Social Share Settings</a>';
}
if (lionwp_is_plugin_active('gdpr')) {
$menu_items[] = '<a href="/admin/gdpr">GDPR Settings</a>';
}
return $menu_items;
}
// Get detailed plugin information
$plugin_info = lionwp_get_plugin_info('social_share');
if ($plugin_info) {
echo "Plugin Name: " . $plugin_info['name'] . "\n";
echo "Version: " . $plugin_info['version'] . "\n";
echo "Description: " . $plugin_info['description'] . "\n";
echo "Author: " . $plugin_info['author'] . "\n";
echo "Active: " . ($plugin_info['active'] ? 'Yes' : 'No') . "\n";
}
// Display plugin information in admin
function display_lionwp_plugins_status() {
$plugins = array('social_share', 'gdpr', 'construction');
echo '<div class="lionwp-plugins-status">';
foreach ($plugins as $plugin) {
$info = lionwp_get_plugin_info($plugin);
if ($info) {
$status = $info['active'] ? 'active' : 'inactive';
echo "<div class='plugin-{$status}'>{$info['name']} - {$info['version']}</div>";
}
}
echo '</div>';
}
Shortcode API
All LionWP plugins provide shortcodes for easy integration into posts, pages, and widgets.
Universal Shortcode Pattern
// Social Share shortcodes
[lionwp_social_share]
[lionwp_social_share platforms="facebook,twitter,linkedin" style="style-5"]
[lionwp_social_share size="large" show_labels="false"]
// GDPR shortcodes (coming soon)
[lionwp_gdpr_notice]
[lionwp_gdpr_notice position="top" style="dark"]
[lionwp_gdpr_consent_form types="analytics,marketing"]
// Under Construction shortcodes (coming soon)
[lionwp_construction_countdown date="2025-12-31"]
[lionwp_construction_signup form="newsletter"]
[lionwp_construction_progress percent="75"]
// Universal shortcode with conditional display
[lionwp_conditional plugin="social_share"]
[lionwp_social_share platforms="facebook,twitter"]
[/lionwp_conditional]
Programmatic Shortcode Usage
// Use shortcodes programmatically
function add_social_share_to_posts($content) {
if (is_single() && lionwp_is_plugin_active('social_share')) {
$social_buttons = do_shortcode('[lionwp_social_share style="style-3"]');
$content .= $social_buttons;
}
return $content;
}
add_filter('the_content', 'add_social_share_to_posts');
// Dynamic shortcode attributes
function dynamic_social_share_shortcode($post_id) {
$post_type = get_post_type($post_id);
$platforms = array('facebook', 'twitter', 'email');
if ($post_type === 'product') {
$platforms[] = 'pinterest';
}
$shortcode_atts = array(
'platforms' => implode(',', $platforms),
'style' => get_option('lionwp_default_style', 'style-1'),
'size' => wp_is_mobile() ? 'small' : 'medium'
);
$atts_string = '';
foreach ($shortcode_atts as $key => $value) {
$atts_string .= " {$key}=\"{$value}\"";
}
return do_shortcode("[lionwp_social_share{$atts_string}]");
}
// Register custom shortcode that combines multiple LionWP features
function lionwp_combined_shortcode($atts) {
$atts = shortcode_atts(array(
'show_social' => 'true',
'show_gdpr' => 'true',
'social_style' => 'style-1',
'gdpr_position' => 'bottom'
), $atts);
$output = '';
if ($atts['show_social'] === 'true' && lionwp_is_plugin_active('social_share')) {
$output .= do_shortcode("[lionwp_social_share style=\"{$atts['social_style']}\"]");
}
if ($atts['show_gdpr'] === 'true' && lionwp_is_plugin_active('gdpr')) {
$output .= do_shortcode("[lionwp_gdpr_notice position=\"{$atts['gdpr_position']}\"]");
}
return $output;
}
add_shortcode('lionwp_combined', 'lionwp_combined_shortcode');
Limited-Time Offer