Bulk Page Creator - Version 1.0.2

Version Description

Download this release

Release Info

Developer DaganLev
Plugin Icon wp plugin Bulk Page Creator
Version 1.0.2
Comparing to
See all releases

Code changes from version 1.0.1 to 1.0.2

Files changed (2) hide show
  1. bulk-page-creator.php +18 -2
  2. my-script.js +8 -0
bulk-page-creator.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Bulk Page Creator
4
  Plugin URI: http://solid-code.co.uk/2011/05/bulk-page-creator/
5
  Description: Allows you to create multiple pages in a batch/bulk manner saving time when initially setting up your WordPress site.
6
- Version: 1.0.1
7
  Author: Dagan Lev
8
  Author URI: http://solid-code.co.uk
9
 
@@ -70,12 +70,17 @@ if (!class_exists("sc_bulk_page_creator")) {
70
  }
71
  if($parent==-1) $parent = 0;
72
 
 
 
 
 
 
73
  $params = array(
74
  'post_type' => 'page',
75
  'post_status' => 'publish',
76
  'post_parent' => $parent,
77
  'post_title' => rtrim($rres[5]),
78
- 'post_content' => '<h1>' . htmlentities($rres[5]) . '</h1>');
79
 
80
  global $wpdb;
81
  $params['menu_order'] = $wpdb->get_var("SELECT MAX(menu_order)+1 AS menu_order FROM {$wpdb->posts} WHERE post_type='page'");
@@ -121,6 +126,17 @@ if (!class_exists("sc_bulk_page_creator")) {
121
  <form id="sc-add-pages" name="sc-add-pages" method="post" action="?page=<?php echo $_GET['page']; ?>">
122
  <textarea id="sc-pages" name="sc-pages" style="display:none;"></textarea>
123
  <p>When you are ready to commit your changes to the site just click the button below...</p>
 
 
 
 
 
 
 
 
 
 
 
124
  <input type="submit" class="button-primary" value="Update Site" />
125
  </form>
126
  </div>
3
  Plugin Name: Bulk Page Creator
4
  Plugin URI: http://solid-code.co.uk/2011/05/bulk-page-creator/
5
  Description: Allows you to create multiple pages in a batch/bulk manner saving time when initially setting up your WordPress site.
6
+ Version: 1.0.2
7
  Author: Dagan Lev
8
  Author URI: http://solid-code.co.uk
9
 
70
  }
71
  if($parent==-1) $parent = 0;
72
 
73
+ $pcontent = '';
74
+ if($_POST['pcontent']=='2'){
75
+ $pcontent = str_ireplace('[pagetitle]','<h1>' . htmlentities($rres[5]) . '</h1>',$_POST['sc-pages-content']);
76
+ }
77
+
78
  $params = array(
79
  'post_type' => 'page',
80
  'post_status' => 'publish',
81
  'post_parent' => $parent,
82
  'post_title' => rtrim($rres[5]),
83
+ 'post_content' => $pcontent);
84
 
85
  global $wpdb;
86
  $params['menu_order'] = $wpdb->get_var("SELECT MAX(menu_order)+1 AS menu_order FROM {$wpdb->posts} WHERE post_type='page'");
126
  <form id="sc-add-pages" name="sc-add-pages" method="post" action="?page=<?php echo $_GET['page']; ?>">
127
  <textarea id="sc-pages" name="sc-pages" style="display:none;"></textarea>
128
  <p>When you are ready to commit your changes to the site just click the button below...</p>
129
+ <select id="pcontent" name="pcontent">
130
+ <option value="1">Create Empty Pages</option>
131
+ <option value="2">Set Pages Content</option>
132
+ </select>
133
+ <div id="sc-pages-content-div" style="display:none;">
134
+ <p>
135
+ You can specify default content for all the pages in the text area below.<br />
136
+ You can also use the [pagetitle] short code to add a H1 (header) tag with the individual page title...
137
+ </p>
138
+ <textarea cols="60" rows="5" id="sc-pages-content" name="sc-pages-content"></textarea><br /><br />
139
+ </div>
140
  <input type="submit" class="button-primary" value="Update Site" />
141
  </form>
142
  </div>
my-script.js CHANGED
@@ -4,6 +4,14 @@ jQuery(document).ready(function(){
4
  if(jQuery('#page_id').size()==0){
5
  jQuery('#page_ids').append('<select id="page_id" name="page_id"><option value="">(No Parent)</option></select>');
6
  }
 
 
 
 
 
 
 
 
7
  });
8
 
9
  function sc_add_page(){
4
  if(jQuery('#page_id').size()==0){
5
  jQuery('#page_ids').append('<select id="page_id" name="page_id"><option value="">(No Parent)</option></select>');
6
  }
7
+
8
+ jQuery('#pcontent').change(function(){
9
+ if(jQuery(this).val()==1){
10
+ jQuery('#sc-pages-content-div').hide();
11
+ }else{
12
+ jQuery('#sc-pages-content-div').show();
13
+ }
14
+ });
15
  });
16
 
17
  function sc_add_page(){