File: /home/dwauav0tm6jp/www/wp-content/themes/photographer-wp/admin/meta-box-portfolio-details.php
<?php
function pixelwars_theme_custom_box_show_portfolio($post)
{
?>
<?php
wp_nonce_field('pixelwars_theme_custom_box_show_portfolio', 'pixelwars_theme_custom_box_nonce_portfolio');
?>
<h4>
<?php
echo __('Type', 'read');
?>
</h4>
<p class="pf-type-wrap">
<?php
$pf_type = get_option($post->ID . 'pf_type', 'Standard');
?>
<label>
<input type="radio" name="pf_type" <?php if ($pf_type == 'Standard') { echo 'checked="checked"'; } ?> value="Standard"> <?php echo __('Standard', 'read'); ?>
</label>
<br>
<label>
<input type="radio" name="pf_type" <?php if ($pf_type == 'Photo Gallery') { echo 'checked="checked"'; } ?> value="Photo Gallery"> <?php echo __('Photo Gallery', 'read'); ?>
</label>
<br>
<label>
<input type="radio" name="pf_type" <?php if ($pf_type == 'Photo Gallery 2') { echo 'checked="checked"'; } ?> value="Photo Gallery 2"> <?php echo __('Photo Gallery 2', 'read'); ?>
</label>
<br>
<label>
<input type="radio" name="pf_type" <?php if ($pf_type == 'Photo Gallery 3') { echo 'checked="checked"'; } ?> value="Photo Gallery 3"> <?php echo __('Photo Gallery 3', 'read'); ?>
</label>
</p>
<hr>
<h4>
<?php
echo __('Short Description', 'read');
?>
</h4>
<p>
<?php
$pf_short_description = stripcslashes(get_option($post->ID . 'pf_short_description'));
?>
<textarea id="pf_short_description" name="pf_short_description" rows="4" cols="46" class="widefat"><?php echo $pf_short_description; ?></textarea>
</p>
<?php
}
function pixelwars_theme_custom_box_add_portfolio()
{
add_meta_box('pixelwars_theme_custom_box_portfolio', __('Details', 'read'), 'pixelwars_theme_custom_box_show_portfolio', 'portfolio', 'side', 'low');
}
add_action('add_meta_boxes', 'pixelwars_theme_custom_box_add_portfolio');
function pixelwars_theme_custom_box_save_portfolio( $post_id )
{
if ( ! isset( $_POST['pixelwars_theme_custom_box_nonce_portfolio'] ) )
{
return $post_id;
}
$nonce = $_POST['pixelwars_theme_custom_box_nonce_portfolio'];
if ( ! wp_verify_nonce( $nonce, 'pixelwars_theme_custom_box_show_portfolio' ) )
{
return $post_id;
}
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
{
return $post_id;
}
if ( 'page' == $_POST['post_type'] )
{
if ( ! current_user_can( 'edit_page', $post_id ) )
{
return $post_id;
}
}
else
{
if ( ! current_user_can( 'edit_post', $post_id ) )
{
return $post_id;
}
}
update_option( $post_id . 'pf_type', $_POST['pf_type'] );
update_option( $post_id . 'pf_short_description', $_POST['pf_short_description'] );
}
add_action( 'save_post', 'pixelwars_theme_custom_box_save_portfolio' );
?>