Changeset 1067116
- Timestamp:
- 01/13/2015 02:31:24 PM (11 years ago)
- File:
-
- 1 edited
-
addthis/trunk/includes/addthis_addjs_new.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
addthis/trunk/includes/addthis_addjs_new.php
r1067109 r1067116 68 68 69 69 // for saving custom field value for show/hide addthis sharing button in admin post add/edit page. 70 add_action('pre_post_update', array($this, 'save_ product_data'));71 add_action('save_post', array($this, 'save_ product_data'));72 add_action('publish_post', array($this, 'save_ product_data'));73 add_action('edit_page_form', array($this, 'save_ product_data'));70 add_action('pre_post_update', array($this, 'save_at_flag')); 71 add_action('save_post', array($this, 'save_at_flag')); 72 add_action('publish_post', array($this, 'save_at_flag')); 73 add_action('edit_page_form', array($this, 'save_at_flag')); 74 74 75 75 … … 203 203 return null; 204 204 } 205 206 /* 207 * Function to add checkbox to show/hide Addthis sharing buttons in admin post add/edit page. 208 */ 209 public function register_post_at_flag() { 210 add_meta_box('at_widget', __('AddThis For Wordpress'), array($this, 'add_at_flag_meta_box'), 'post', 'advanced', 'high'); 211 } 212 /* 213 * Function to add checkbox to show/hide Addthis sharing buttons in admin post add/edit page. 214 */ 215 public function add_at_flag_meta_box($post){ 216 $at_flag = get_post_meta($post->ID, '_at_widget', true); 217 echo "<label for='_at_widget'>".__('Show AddThis Sharing buttons: ', 'foobar')."</label>"; 218 if($at_flag != '' && $at_flag == '1'){ 219 echo "<input type='checkbox' name='_at_widget' id='at_widget' value='1' checked='checked'/>"; 220 } else if($at_flag == '' || $at_flag == '0'){ 221 echo "<input type='checkbox' name='_at_widget' id='at_widget' value='1'/>"; 222 } 223 } 224 /* 225 * Function to add save the value of checkbox to show/hide Addthis sharing buttons in admin post add/edit page. 226 */ 227 function save_at_flag(){ 228 //print_r($post); 229 global $post; 230 if(isset($_POST['_at_widget'])) 231 update_post_meta($post->ID, '_at_widget', $_POST['_at_widget']); 232 else 233 update_post_meta($post->ID, '_at_widget', '0'); 234 //update_post_meta($post->ID, '_product_number', $_POST['_product_number']); 235 } 205 236 }
Note: See TracChangeset
for help on using the changeset viewer.