Changeset 1040015
- Timestamp:
- 12/07/2014 09:34:53 PM (11 years ago)
- Location:
- sharedaddy-shortcode/trunk
- Files:
-
- 2 added
- 2 edited
-
class.sharedaddy-shortcode.php (added)
-
readme.txt (modified) (2 diffs)
-
sharedaddy-shortcode.php (modified) (1 diff)
-
widget.sharedaddy-shortcode.php (added)
Legend:
- Unmodified
- Added
- Removed
-
sharedaddy-shortcode/trunk/readme.txt
r1039972 r1040015 29 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 = Another set of sharebuttons doesnt work = 32 Du to limitations in Jetpacks Sharedaddy you can only have one set of sharebuttons. 33 31 34 == Screenshots == 32 35 33 36 == Changelog == 37 38 = 1.2.0 = 39 Put everything in a SharedaddyShortcode class and added a widget as an alternative to the shortcode. 34 40 35 41 = 1.1.0 = … … 44 50 == Upgrade Notice == 45 51 52 = 1.2.0 53 * Major rewrite 54 * Added widget 55 46 56 = 1.1.0 = 47 57 * Settings added to -
sharedaddy-shortcode/trunk/sharedaddy-shortcode.php
r1039972 r1040015 7 7 * Requires at least: 4.0 8 8 * Tested up to: 4.0.1 9 * Version: 1. 1.010 * Stable tag: 1. 1.09 * Version: 1.2.0 10 * Stable tag: 1.2.0 11 11 * License: GPL2+ 12 12 */ 13 13 14 function func_shareDaddyShortcode_display() 15 { 16 global $post; 17 if (function_exists('sharing_display')) { 18 if (!$post) { 19 $_post = $post; 20 $post = 'temp_sharedaddy'; 21 } 22 sharing_display('', true); 23 if ($post == 'temp_sharedaddy') { 24 unset($post); 25 $post = $_post; 26 } 27 } 28 } 29 function func_shareDaddyShortcode_removeOld() 30 { 31 if (has_filter('the_content', 'sharing_display')) { 32 remove_filter('the_content', 'sharing_display', 19); 33 } 34 if (has_filter('the_excerpt', 'sharing_display')) { 35 remove_filter('the_excerpt', 'sharing_display', 19); 36 } 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 ); 14 require_once 'class.sharedaddy-shortcode.php'; 15 require_once 'widget.sharedaddy-shortcode.php'; 52 16 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 80 add_filter('the_content', 'func_shareDaddyShortcode_removeOld', 1); 81 add_filter('the_excerpt', 'func_shareDaddyShortcode_removeOld', 1); 82 83 // Add [sharedaddy] as available shortcode 84 add_shortcode('sharedaddy', 'func_shareDaddyShortcode_display'); 17 SharedaddyShortcode::init();
Note: See TracChangeset
for help on using the changeset viewer.