Last active
October 8, 2015 14:49
-
-
Save smartcatdev/ed60d4eb02bca89aaee9 to your computer and use it in GitHub Desktop.
This wil help you create a custom meta. it has not been tested
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('add_meta_boxes', 'ceo_tribe_image_meta_box' ); | |
public function ceo_tribe_image_meta_box() { | |
add_meta_box( | |
'page_info_box_permission', __('Page Permission', 'tribe'), 'page_info_box_format', 'page', 'side', 'low' | |
); | |
} | |
function page_info_box_format( $post ) { ?> | |
<?php $format = get_post_meta( $post->ID, 'single_image_align', TRUE ); ?> | |
<div class="form-group"> | |
<label>Select Post Format</label> | |
<select name="single_image_align" class="form-control"> | |
<option value="top" <?php selected( $format, 'top'); ?>>Top</option> | |
<option value="center" <?php selected( $format, 'center'); ?>>Center</option> | |
<option value="bottom" <?php selected( $format, 'bottom'); ?>>Bottom</option> | |
</select> | |
</div> | |
<?php } | |
function tribe_single_box_save($post_id) { | |
if (isset($_REQUEST['single_image_align'])) { | |
update_post_meta($post_id, 'single_image_align', $_POST['single_image_align']); | |
} | |
} | |
add_action( 'save_post', 'tribe_single_box_save' ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks homie