Duplicate Page and Post - Version 2.0

Version Description

Download this release

Release Info

Developer arjunthakur
Plugin Icon 128x128 Duplicate Page and Post
Version 2.0
Comparing to
See all releases

Code changes from version 1.0.1 to 2.0

duplicate-wp-page-post-setting.php ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ( ! defined( 'ABSPATH' ) ) exit; ?>
2
+ <div class="wrap dpp_page_settings">
3
+ <h1><?php _e('Plugin Settings', 'dpp_wpp_page')?></h1>
4
+ <?php $dpp_options = array();
5
+ $opt = get_option('dpp_wpp_page_options');
6
+ $instruct = isset($_GET['instruct']) ? $_GET['instruct'] : '';
7
+ if(isset($_POST['submit_dpp_wpp_page']) && wp_verify_nonce( $_POST['dpp_nonce_field'], 'dpp_page_action' )):
8
+ _e("<strong>changes saving..</strong>", 'dpp_wpp_page');
9
+ $dpp_nosave = array('submit_dpp_wpp_page');
10
+ foreach($dpp_nosave as $noneed):
11
+ unset($_POST[$noneed]);
12
+ endforeach;
13
+ foreach($_POST as $key => $val):
14
+ $dpp_options[$key] = $val;
15
+ endforeach;
16
+ $dpp_settings_save = update_option('dpp_wpp_page_options', $dpp_options );
17
+ if($dpp_settings_save){ dpp_wpp_page::dp_redirect('options-general.php?page=dpp_page_settings&instruct=1'); }
18
+ else{ dpp_wpp_page::dp_redirect('options-general.php?page=dpp_page_settings&instruct=2'); }endif;
19
+ if(!empty($instruct) && $instruct == 1):
20
+ _e( '<div class="updated settings-error dpp_pluginnotice is-dismissible" id="setting-error-settings_updated">
21
+ <p><strong>Changes saved.</strong></p><button class="notice-ignore" type="button"><span class="screen-reader-text">Ignore this notice.</span></button></div>', 'dpp_wpp_page');
22
+ elseif(!empty($instruct) && $instruct == 2):
23
+ _e( '<div class="error settings-error dpp_pluginnotice is-dismissible" id="setting-error-settings_updated">
24
+ <p><strong>Changes not saved.</strong></p><button class="notice-ignore" type="button"><span class="screen-reader-text">Ignore this notice.</span></button></div>', 'dpp_wpp_page');
25
+ endif;
26
+ $dpp_post_status = array('draft');
27
+ ?>
28
+ <div id="dpp-stuff">
29
+ <div id="dpp-post-body" class="metabox-holder columns-2">
30
+ <div id="dpp-post-body-content" style="position: relative;">
31
+ <form style="padding: 10px; border: 1px solid #333;" action="" method="post" name="dpp_wpp_page_form">
32
+ <?php wp_nonce_field( 'dpp_page_action', 'dpp_nonce_field' ); ?>
33
+ <table class="form-table">
34
+ <tbody>
35
+ <tr><th scope="row"><label for="dpp_post_suffix"><?php _e('Duplicate Post Suffix', 'dpp_wpp_page')?></label></th>
36
+ <h3 style="color: red;"><?php _e('Add a suffix for duplicate or clone post as Copy, Clone etc. It will show after title.', 'dpp_wpp_page')?></h3>
37
+ <td><input type="text" class="regular-text" value="<?php echo !empty($opt['dpp_post_suffix']) ? $opt['dpp_post_suffix'] : ''?>" id="dpp_post_suffix" name="dpp_post_suffix"></td>
38
+ </tr>
39
+ </tbody>
40
+ </table>
41
+ <p class="submit"><input type="submit" value="Save Settings" class="button button-primary" id="submit" name="submit_dpp_wpp_page"></p>
42
+ </form>
43
+ </div>
44
+ </div>
45
+ </div>
46
+ </div>
47
+ </div>
48
+ </div>
duplicate-wp-page-post.php CHANGED
@@ -1,11 +1,12 @@
 
1
  <?php
2
  /*
3
  Plugin Name: Duplicate Page and Post
4
- Plugin URI: http://www.hisysinfotech.com/
5
  Description: This plugin quickly creates a clone of page or post
6
  Author: Arjun Thakur
7
  Author URI: http://www.hisysinfotech.com/
8
- Version: 1.0.1
9
  License: GPLv2 or later
10
  Text Domain: dpp_wpp_page
11
  */
@@ -19,6 +20,8 @@ if(!class_exists('dcc_dpp_wpp_page')):
19
  public function __construct()
20
  {
21
  register_activation_hook(__FILE__, array(&$this, 'dpp_wpp_page_install'));
 
 
22
  add_action( 'admin_action_dt_dpp_post_as_draft', array(&$this,'dt_dpp_post_as_draft') );
23
  add_filter( 'post_row_actions', array(&$this,'dt_dpp_post_link'), 10, 2);
24
  add_filter( 'page_row_actions', array(&$this,'dt_dpp_post_link'), 10, 2);
@@ -26,7 +29,7 @@ if(!class_exists('dcc_dpp_wpp_page')):
26
  add_action( 'wp_before_admin_bar_render', array(&$this, 'dpp_wpp_page_admin_bar_link'));
27
  }
28
 
29
- /*Activation Hook*/
30
  public function dpp_wpp_page_install()
31
  {
32
  $defaultsettings = array('dpp_post_status' => 'draft',
@@ -38,6 +41,23 @@ if(!class_exists('dcc_dpp_wpp_page')):
38
  update_option('dpp_wpp_page_options', $defaultsettings);
39
  }
40
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
 
42
  /*Important function*/
43
  public function dt_dpp_post_as_draft()
@@ -124,7 +144,7 @@ if(!class_exists('dcc_dpp_wpp_page')):
124
  $opt = get_option('dpp_wpp_page_options');
125
  $post_status = !empty($opt['dpp_post_status']) ? $opt['dpp_post_status'] : 'draft';
126
  if (current_user_can('edit_posts')) {
127
- $actions['dpp'] = '<a href="admin.php?action=dt_dpp_post_as_draft&amp;post=' . $post->ID . '" title="Clone this as '.$post_status.'" rel="permalink">Click here to Clone</a>';
128
  }
129
  return $actions;
130
  }
@@ -136,7 +156,7 @@ if(!class_exists('dcc_dpp_wpp_page')):
136
  global $post;
137
  $html = '<div id="major-publishing-actions">';
138
  $html .= '<div id="export-action">';
139
- $html .= '<a href="admin.php?action=dt_dpp_post_as_draft&amp;post=' . $post->ID . '" title="dpp this as '.$post_status.'" rel="permalink">Click here to Clone</a>';
140
  $html .= '</div>';
141
  $html .= '</div>';
142
  echo $html;
@@ -156,7 +176,7 @@ if(!class_exists('dcc_dpp_wpp_page')):
156
  {
157
  $wp_admin_bar->add_menu( array('parent' => 'edit',
158
  'id' => 'dpp_this',
159
- 'title' => __("dpp this as ".$post_status."", 'dpp_wpp_page'),
160
  'href' => admin_url().'admin.php?action=dt_dpp_post_as_draft&amp;post=' . $post->ID
161
  ) );
162
  }
1
+
2
  <?php
3
  /*
4
  Plugin Name: Duplicate Page and Post
5
+ Plugin URI: https://wordpress.org/plugins/duplicate-wp-page-post/
6
  Description: This plugin quickly creates a clone of page or post
7
  Author: Arjun Thakur
8
  Author URI: http://www.hisysinfotech.com/
9
+ Version: 2.1
10
  License: GPLv2 or later
11
  Text Domain: dpp_wpp_page
12
  */
20
  public function __construct()
21
  {
22
  register_activation_hook(__FILE__, array(&$this, 'dpp_wpp_page_install'));
23
+ add_action('admin_menu', array(&$this, 'dpp_page_options_page'));
24
+ add_filter( 'plugin_action_links', array(&$this, 'dpp_page_plugin_action_links'), 10, 2 );
25
  add_action( 'admin_action_dt_dpp_post_as_draft', array(&$this,'dt_dpp_post_as_draft') );
26
  add_filter( 'post_row_actions', array(&$this,'dt_dpp_post_link'), 10, 2);
27
  add_filter( 'page_row_actions', array(&$this,'dt_dpp_post_link'), 10, 2);
29
  add_action( 'wp_before_admin_bar_render', array(&$this, 'dpp_wpp_page_admin_bar_link'));
30
  }
31
 
32
+ /*Activation plugin Hook*/
33
  public function dpp_wpp_page_install()
34
  {
35
  $defaultsettings = array('dpp_post_status' => 'draft',
41
  update_option('dpp_wpp_page_options', $defaultsettings);
42
  }
43
  }
44
+
45
+ /* Plugin Action Links(Dashboard) */
46
+ public function dpp_page_plugin_action_links($links, $file){
47
+ return $links;
48
+ }
49
+
50
+ /* Page Title and Dashboard Menu (Setting options) */
51
+ public function dpp_page_options_page(){
52
+ add_options_page( __( 'Duplicate Page and Post', 'dpp_wpp_page' ), __( 'Duplicate post', 'dpp_wpp_page' ), 'manage_options', 'dpp_page_settings',array(&$this, 'dpp_page_settings'));
53
+ }
54
+
55
+ /*Include plugin setting file*/
56
+ public function dpp_page_settings(){
57
+ if(current_user_can( 'manage_options' )){
58
+ include('duplicate-wp-page-post-setting.php');
59
+ }
60
+ }
61
 
62
  /*Important function*/
63
  public function dt_dpp_post_as_draft()
144
  $opt = get_option('dpp_wpp_page_options');
145
  $post_status = !empty($opt['dpp_post_status']) ? $opt['dpp_post_status'] : 'draft';
146
  if (current_user_can('edit_posts')) {
147
+ $actions['dpp'] = '<a href="admin.php?action=dt_dpp_post_as_draft&amp;post=' . $post->ID . '" title="Clone this as '.$post_status.'" rel="permalink">Duplicate</a>';
148
  }
149
  return $actions;
150
  }
156
  global $post;
157
  $html = '<div id="major-publishing-actions">';
158
  $html .= '<div id="export-action">';
159
+ $html .= '<a href="admin.php?action=dt_dpp_post_as_draft&amp;post=' . $post->ID . '" title="Clone this as '.$post_status.'" rel="permalink">Duplicate</a>';
160
  $html .= '</div>';
161
  $html .= '</div>';
162
  echo $html;
176
  {
177
  $wp_admin_bar->add_menu( array('parent' => 'edit',
178
  'id' => 'dpp_this',
179
+ 'title' => __("Clone this as ".$post_status."", 'dpp_wpp_page'),
180
  'href' => admin_url().'admin.php?action=dt_dpp_post_as_draft&amp;post=' . $post->ID
181
  ) );
182
  }
readme.txt CHANGED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Duplicate Page and Post ===
2
+ Contributors: arjunthakur
3
+ Donate link: http://www.hisysinfotech.com/
4
+ Tags: duplicate post, duplicate page, duplicate custom posts, wordpress page duplicator, wordpress post duplicator, page duplicate, page and post clone, page clone, post clone, wp post clone.
5
+ Requires at least: 3.5
6
+ Tested up to: 4.8.1
7
+ Stable tag: 2.0
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ Duplicate posts, pages and custom posts or page and post clone.
12
+
13
+ == Description ==
14
+
15
+ Duplicate page and post plugin provides functionality to creates a clone of page or posts,
16
+ You can duplicate pages, posts and custom post by click and it will be saved as draft.
17
+ Duplicate page and post doesn't have a lot of features that other plugins have, but it
18
+ also is lightning fast by comparison.
19
+
20
+ = Major features of this plugin include =
21
+
22
+ 1. Create a clone of particular page.
23
+ 2. Create a clone of particular post.
24
+ 3. Create a clone of particular custom post(CPT).
25
+
26
+ == Installation ==
27
+
28
+ The plugin is simple to install:
29
+
30
+ 1. Download duplicate-wp-page-post.zip
31
+ 2. Unzip
32
+ 3. Upload duplicate-wp-page-post directory to your /wp-content/plugins directory
33
+ 4. Go to the plugin menu page and activate the plugin
34
+
35
+ == Frequently asked questions ==
36
+
37
+ = How to create the duplicate of a page or a post? =
38
+
39
+ 1. Activate the plugin through the 'Plugins' menu in WordPress.
40
+ 2. Then Create New Post/Page Or you can use old one.
41
+ 3. Now go to all pages or all posts page on your dashboard.
42
+ 4. Hover your cursor over any page or any post on dashboard section, you'll see a "Click here to clone" Button.
43
+ 5. After you click on "Click here to Clone" link, then duplicate post/page will be created and saved as draft, make the changes you wish and hit publish.
44
+
45
+ = What is the benefit of using this plugin? =
46
+
47
+ User can easily duplicate the posts, pages or the custom posts with single click. It saves user's time to re-create the same post or page again.
48
+
49
+ == Screenshots ==
50
+
51
+ 1. screenshot1.png
52
+ 2. screenshot2.png
53
+ 3. screenshot3.png
54
+ 4. screenshot4.png