| 1 |
<?php |
| 2 |
|
| 3 |
/* --------------------------------------------------------- */ |
| 4 |
/* !Create an admin notice that a post has been duplicated - 2.25 */ |
| 5 |
/* --------------------------------------------------------- */ |
| 6 |
|
| 7 |
function mtphr_post_duplicator_notice() { |
| 8 |
|
| 9 |
$duplicated_id = isset( $_GET['post-duplicated'] ) ? intval( $_GET['post-duplicated'] ) : ''; |
| 10 |
if( $duplicated_id != '' ) { |
| 11 |
|
| 12 |
$settings = get_mtphr_post_duplicator_settings(); |
| 13 |
|
| 14 |
// Get the post type object |
| 15 |
$duplicated_post = get_post( $duplicated_id ); |
| 16 |
$post_type = get_post_type_object( $duplicated_post->post_type ); |
| 17 |
|
| 18 |
// Set the button label |
| 19 |
$pt = $post_type->labels->singular_name; |
| 20 |
$link = '<a href="'.get_edit_post_link( $duplicated_id ).'">'.esc_html__( 'here', 'post-duplicator' ).'</a>'; |
| 21 |
$label = sprintf( __( 'Successfully Duplicated! You can edit your new %1$s %2$s.', 'post-duplicator' ), $pt, $link ); |
| 22 |
|
| 23 |
?> |
| 24 |
<div class="updated"> |
| 25 |
<p><?php echo wp_kses_post( $label ); ?></p> |
| 26 |
</div> |
| 27 |
<?php |
| 28 |
} |
| 29 |
} |
| 30 |
add_action('admin_notices', 'mtphr_post_duplicator_notice'); |