";
$metabox_title .= esc_html__( 'ACTUS MOTION', 'actus-motion' );
$pg_type = 'post';
if ( get_current_screen()->id == "page" ) {
$pg_type = 'page';
}
add_meta_box(
'actus-mtn-box',
$metabox_title,
'actus_mtn_box_content',
$pg_type,
'normal', // Context
'default' // Priority
);
}
/**
* Metaboxes Content
*
* Initialize and display the ACTUS motion metaboxes.
*
* @global array $actus_mtn_admin_options The array of motion options.
*
* @constant string ACTUS_MTN_URL URL of the Plugin.
*/
function actus_mtn_box_content( $post ) {
global $actus_mtn_admin_options;
$events_str = '';
foreach ($actus_mtn_admin_options['motion-events'] as $key => $event) {
$events_str .= $key . ',';
}
$events_str = rtrim($events_str, ',');
?>
ID;
/*
// Authorization Check
if ( empty( $post ) || empty( $post_id ) || empty( $_POST ) ) return;
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;
if ( is_int( wp_is_post_revision( $post ) ) ) return;
if ( is_int( wp_is_post_autosave( $post ) ) ) return;
if ( isset( $_POST['post_type'] ) && 'page' == $_POST['post_type'] ) {
if ( ! current_user_can( 'edit_page', $post_id ) ) {
return;
}
} else {
if ( ! current_user_can( 'edit_post', $post_id ) ) {
return;
}
}
*/
// Check if our nonce is set.
if ( isset( $_POST['actus_mtn_save_nonce'] ) ) {
// Verify that the nonce is valid.
if ( wp_verify_nonce( $_POST['actus_mtn_save_nonce'], 'actus_mtn_save_nonce' ) ) {
// SAVE options (actus_mtn_options)
if ( isset( $_POST['actus_motion_array'] ) ) {
$data = sanitize_text_field( $_POST['actus_motion_array'] );
update_post_meta( $post_id, 'actus_motion_array', $data );
}
// SAVE slide options (actus_mtn_admin_options)
if ( isset( $_POST['actus_mtn_admin_options'] ) ) {
$data = sanitize_text_field( $_POST['actus_mtn_admin_options'] );
update_post_meta( $post_id, 'actus_mtn_admin_options', $data );
}
}
}
}