Changeset 1039972
- Timestamp:
- 12/07/2014 08:13:43 PM (11 years ago)
- Location:
- sharedaddy-shortcode/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (4 diffs)
-
sharedaddy-shortcode.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sharedaddy-shortcode/trunk/readme.txt
r1037385 r1039972 11 11 12 12 == Description == 13 Sharedaddy is a social sharing button plugin that nowadays ships with the Jetpack wordpress plugin re-labeled 14 as Sharing Buttons. It doesn't offer much options on where to place it though so theres where this plugin 15 comes in. It removes the default Jetpack trigger to place the sharebuttons and instead places it inside 16 the [sharedaddy] shortcode. 13 Sharedaddy is a social sharing button plugin that nowadays ships with the Jetpack wordpress plugin re-labeled as Sharing Buttons. It doesn't offer much options on where to place it though so theres where this plugin comes in. It removes the default Jetpack trigger to place the sharebuttons and instead places it inside the [sharedaddy] shortcode. 17 14 18 15 == Installation == … … 21 18 3. Enable the plugin 22 19 4. Use the [sharedaddy] shortcode where you now want the social sharing buttons to appear instead 20 5. (optional) enable widget shortcode in Settings -> General -> Sharedaddy Shortcode 23 21 24 22 == Frequently Asked Questions == … … 28 26 and called Sharing Buttons. This plugin doesn't do anything unless Jetpack is installed. 29 27 28 = How do I enable shortcode in widgets = 29 Under Settings -> General theres a section called Sharedaddy Shortcode there you can enable widget shortcodes. This is global and not just for Sharedaddy Shortcode. 30 30 31 == Screenshots == 31 32 32 33 == Changelog == 34 35 = 1.1.0 = 36 Added settings in General to enable/disable shortcode in widgets 33 37 34 38 = 1.0.1 = … … 40 44 == Upgrade Notice == 41 45 46 = 1.1.0 = 47 * Settings added to 48 42 49 = 1.0.1 = 43 50 * Now displays properly even with no post -
sharedaddy-shortcode/trunk/sharedaddy-shortcode.php
r1037383 r1039972 7 7 * Requires at least: 4.0 8 8 * Tested up to: 4.0.1 9 * Version: 2014120210 * Stable tag: 1. 0.19 * Version: 1.1.0 10 * Stable tag: 1.1.0 11 11 * License: GPL2+ 12 12 */ 13 13 14 function func_shareDaddyShortcode_display() { 14 function func_shareDaddyShortcode_display() 15 { 15 16 global $post; 16 17 if (function_exists('sharing_display')) { 17 18 if (!$post) { 19 $_post = $post; 18 20 $post = 'temp_sharedaddy'; 19 21 } … … 21 23 if ($post == 'temp_sharedaddy') { 22 24 unset($post); 25 $post = $_post; 23 26 } 24 27 } 25 28 } 26 function func_shareDaddyShortcode_removeOld() { 29 function func_shareDaddyShortcode_removeOld() 30 { 27 31 if (has_filter('the_content', 'sharing_display')) { 28 32 remove_filter('the_content', 'sharing_display', 19); … … 32 36 } 33 37 } 38 function func_shareDaddyShortcode_enableShortcode() 39 { 40 if (get_option('settings_shareDaddyShortCode_enableWidgetShortcode')) { 41 add_filter('widget_text', 'do_shortcode'); 42 } 43 } 44 function settings_shareDaddyShortcode() 45 { 46 add_settings_section( 47 'settings_section_shareDaddyShortcode', 48 'Sharedaddy Shortcode', 49 'settings_section_callback_shareDaddyShortcode', 50 'general' 51 ); 34 52 53 add_settings_field( 54 'settings_shareDaddyShortCode_enableWidgetShortcode', 55 'Enable shortcode in widgets', 56 'settings_callback_shareDaddyShortcode', 57 'general', 58 'settings_section_shareDaddyShortcode' 59 ); 60 61 register_setting('general', 'settings_shareDaddyShortCode_enableWidgetShortcode'); 62 } 63 function settings_section_callback_shareDaddyShortcode() 64 { 65 echo '<p>Enable shortcode in widgets (not just for Sharedaddy Shortcode)</p>'; 66 } 67 function settings_callback_shareDaddyShortcode() 68 { 69 echo '<input name="settings_shareDaddyShortCode_enableWidgetShortcode" id="settings_shareDaddyShortCode_enableWidgetShortcode" value="1" type="checkbox" class="code" '; 70 echo checked(1, get_option('settings_shareDaddyShortCode_enableWidgetShortcode'), false).'>'; 71 } 72 73 // Add option to Settings -> General 74 add_action('admin_init', 'settings_shareDaddyShortCode'); 75 76 // Enable shortcode in widgets if needed 77 add_action('widgets_init', 'func_shareDaddyShortcode_enableShortcode', 1); 78 79 // Remove normal Jetpack Sharedaddy filters 35 80 add_filter('the_content', 'func_shareDaddyShortcode_removeOld', 1); 36 81 add_filter('the_excerpt', 'func_shareDaddyShortcode_removeOld', 1); 82 83 // Add [sharedaddy] as available shortcode 37 84 add_shortcode('sharedaddy', 'func_shareDaddyShortcode_display');
Note: See TracChangeset
for help on using the changeset viewer.