/home/desid573/public_html/magicride.ng/wp-content/themes/euphony/inc/metabox
Edit: /home/desid573/public_html/magicride.ng/wp-content/themes/euphony/inc/metabox/metabox.php (4812B)
meta_box = array (
'id' => $meta_box_id,
'title' => $meta_box_title,
'post_type' => $post_type,
);
$this->fields = array(
'euphony-header-image',
'euphony-sidebar-option',
'euphony-featured-image',
);
// Add metaboxes
add_action( 'add_meta_boxes', array( $this, 'add' ) );
add_action( 'save_post', array( $this, 'save' ) );
}
/**
* Add Meta Box for multiple post types.
*
* @since Euphony Pro 1.0
*
* @access public
*/
public function add( $post_type ) {
add_meta_box( $this->meta_box['id'], $this->meta_box['title'], array( $this, 'show' ), $post_type, 'side', 'high' );
}
/**
* Renders metabox
*
* @since Euphony Pro 1.0
*
* @access public
*/
public function show() {
global $post;
$header_image_options = array(
'default' => esc_html__( 'Default', 'euphony' ),
'enable' => esc_html__( 'Enable', 'euphony' ),
'disable' => esc_html__( 'Disable', 'euphony' ),
);
$featured_image_options = array(
'default' => esc_html__( 'Default', 'euphony' ),
'disabled' => esc_html__( 'Disabled', 'euphony' ),
'post-thumbnail' => esc_html__( 'Post Thumbnail (470x470)', 'euphony' ),
'euphony-slider' => esc_html__( 'Slider Image (1920x954)', 'euphony' ),
'full' => esc_html__( 'Original Image Size', 'euphony' ),
);
// Use nonce for verification
wp_nonce_field( basename( __FILE__ ), 'euphony_custom_meta_box_nonce' );
// Begin the field table and loop ?>
meta_box['post_type'] ) ) // Check if current post type is supported.
|| ( ! check_admin_referer( basename( __FILE__ ), 'euphony_custom_meta_box_nonce') ) // Check nonce - Security
|| ( ! current_user_can( $post_type_object->cap->edit_post, $post_id ) ) ) // Check permission
{
return $post_id;
}
foreach ( $this->fields as $field ) {
$new = $_POST[ $field ];
delete_post_meta( $post_id, $field );
if ( '' == $new || array() == $new ) {
return;
} else {
if ( ! update_post_meta ( $post_id, $field, sanitize_key( $new ) ) ) {
add_post_meta( $post_id, $field, sanitize_key( $new ), true );
}
}
} // end foreach
}
}
$euphony_metabox = new Euphony_Metabox(
'euphony-options', //metabox id
esc_html__( 'Euphony Options', 'euphony' ), //metabox title
array( 'page', 'post' ) //metabox post types
);