Skip to content

Commit

Permalink
fix #35
Browse files Browse the repository at this point in the history
  • Loading branch information
fukata committed Sep 9, 2017
1 parent 7bcc554 commit 32fa176
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions FpThumbnailEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,26 +48,28 @@ public static function filterGetPostMetadata($metadata, $object_id, $meta_key, $

public static function actionAddMetaBoxesPost($post) {
add_meta_box(
'wpfp_post_thumbnail',
__('Flickr Thumbnail', FlickrPress::TEXT_DOMAIN),
'wpfp_post_thumbnail',
__('Flickr Thumbnail', FlickrPress::TEXT_DOMAIN),
array(__CLASS__, 'getMetaBoxHtml'),
'post',
'advanced',
'post',
'advanced',
'default',
array($post)
);
}

public static function getMetaBoxHtml($post) {
$use = FlickrPress::isExtractThumbnailByPostID($post->ID);
$use = FlickrPress::isExtractThumbnailByPostID($post->ID);
?>
<p>Use Post Thumbnail: <label class="selectit">Yes <input value="1" type="radio" name="wpfp_use_post_thumbnail" <?php echo $use ? 'checked="checked"' : ''; ?>></label>
<label class="selectit">No <input value="0" type="radio" name="wpfp_use_post_thumbnail" <?php echo !$use ? 'checked="checked"' : ''; ?>></label></p>
<?php
}

public static function filterWpInsertPostData($data, $postarr) {
update_post_meta($postarr['ID'], 'wpfp_use_post_thumbnail', $postarr['wpfp_use_post_thumbnail']);
if ( array_key_exists( 'wpfp_use_post_thumbnail', $postarr ) ) {
update_post_meta($postarr['ID'], 'wpfp_use_post_thumbnail', $postarr['wpfp_use_post_thumbnail']);
}
return $data;
}

Expand Down

0 comments on commit 32fa176

Please sign in to comment.