function duplicate_post_admin_bar_render() { global $wp_admin_bar; $current_object = get_queried_object(); if (empty($current_object)) { return; } if (!empty($current_object->post_type) && ($post_type_object = get_post_type_object($current_object->post_type)) && duplicate_post_is_current_user_allowed_to_copy() && ($post_type_object->show_ui || 'attachment' == $current_object->post_type)) { $wp_admin_bar->add_menu(array('parent' => 'edit', 'id' => 'new_draft', 'title' => __("Copy to a new draft", DUPLICATE_POST_I18N_DOMAIN), 'href' => duplicate_post_get_clone_post_link($current_object->ID))); } }
function duplicate_post_add_duplicate_post_button() { if (isset($_GET['post'])) { $id = $_GET['post']; $post = get_post($id); if (duplicate_post_is_current_user_allowed_to_copy() && duplicate_post_is_post_type_enabled($post->post_type)) { ?> <div id="duplicate-action"> <a class="submitduplicate duplication" href="<?php echo duplicate_post_get_clone_post_link($_GET['post']); ?> "><?php _e('Copy to a new draft', 'duplicate-post'); ?> </a> </div> <?php } } }
function duplicate_post_add_css() { $current_object = get_queried_object(); if (empty($current_object)) { return; } if (!empty($current_object->post_type) && ($post_type_object = get_post_type_object($current_object->post_type)) && duplicate_post_is_current_user_allowed_to_copy() && ($post_type_object->show_ui || 'attachment' == $current_object->post_type) && duplicate_post_is_post_type_enabled($current_object->post_type)) { wp_enqueue_style('duplicate-post', plugins_url('/duplicate-post.css', __FILE__)); } }
function duplicate_post_add_duplicate_post_button() { if (isset($_GET['post']) && duplicate_post_is_current_user_allowed_to_copy()) { ?> <div id="duplicate-action"> <a class="submitduplicate duplication" href="<?php echo duplicate_post_get_clone_post_link($_GET['post']); ?> "><?php _e('Copy to a new draft', DUPLICATE_POST_I18N_DOMAIN); ?> </a> </div> <?php } }
function duplicate_post_add_duplicate_post_button() { if (isset($_GET['post']) && duplicate_post_is_current_user_allowed_to_copy()) { $act = "admin.php?action=duplicate_post_save_as_new_post"; global $post; if ($post->post_type == "page") { $act = "admin.php?action=duplicate_post_save_as_new_page"; } $notifyUrl = $act . "&post=" . $_GET['post']; ?> <div id="duplicate-action"><a class="submitduplicate duplication" href="<?php echo $notifyUrl; ?> "><?php _e('Copy to a new draft', DUPLICATE_POST_I18N_DOMAIN); ?> </a> </div> <?php } }