Changeset 1050490
- Timestamp:
- 12/20/2014 08:51:58 PM (11 years ago)
- Location:
- bulk-page-creator
- Files:
-
- 6 added
- 3 edited
-
tags/1.0.8 (added)
-
tags/1.0.8/bulk-page-creator.php (added)
-
tags/1.0.8/my-script.js (added)
-
tags/1.0.8/my-style.css (added)
-
tags/1.0.8/readme.txt (added)
-
tags/1.0.8/screenshot-1.jpg (added)
-
trunk/bulk-page-creator.php (modified) (6 diffs)
-
trunk/my-script.js (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
bulk-page-creator/trunk/bulk-page-creator.php
r799716 r1050490 4 4 Plugin URI: http://solid-code.co.uk/2011/05/bulk-page-creator/ 5 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. 76 Version: 1.0.8 7 7 Author: Dagan Lev 8 8 Author URI: http://solid-code.co.uk … … 61 61 if(isset($_POST['sc-pages'])&&$_POST['sc-pages']!=''){ 62 62 //form submitted 63 if(preg_match_all('/(\d+\|(-|new)?\d+\|[^\ n]*)/',$_POST['sc-pages'],$match_pg)){63 if(preg_match_all('/(\d+\|(-|new)?\d+\|[^\|]*\|[^\n]*)/',$_POST['sc-pages'],$match_pg)){ 64 64 $newpage = array(); 65 65 foreach($match_pg[0] as $pg_res){ 66 if(preg_match('/((\d+)\|((-|new)?\d+)\|( .*))/',$pg_res,$rres)){66 if(preg_match('/((\d+)\|((-|new)?\d+)\|([^\|]*)\|(.*))/',$pg_res,$rres)){ 67 67 $parent = -1; 68 68 if($rres[4]=='new'){ … … 83 83 'post_parent' => $parent, 84 84 'post_title' => rtrim($rres[5]), 85 'page_template' => rtrim($rres[6]), 85 86 'post_content' => $pcontent); 86 87 … … 88 89 $params['menu_order'] = $wpdb->get_var("SELECT MAX(menu_order)+1 AS menu_order FROM {$wpdb->posts} WHERE post_type='page'"); 89 90 $wpdb->flush(); 90 91 91 92 $newpage[$rres[2]] = wp_insert_post($params); 92 93 } … … 114 115 <small>allows you to create multiple pages by seperating them with a comma; I.E. test1,test2,test3 - will create three pages (do not leave any spaces).</small> 115 116 </p> 117 <?php $templates = get_page_templates(); ?> 116 118 <table> 117 119 <tr> 118 120 <td>Page Name</td> 119 121 <td>Parent</td> 122 <?php echo($templates ? '<td>Template</td>' : ''); ?> 120 123 <td> </td> 121 124 </tr> … … 125 128 <?php wp_dropdown_pages('sort_column=menu_order&post_status=draft,publish&show_option_none=(No Parent)'); ?> 126 129 </td> 130 <?php 131 if($templates){ 132 echo '<td> 133 <select id="page_template" name="page_template"> 134 <option value="">Default</option>'; 135 foreach ( $templates as $template_name => $template_filename ) { 136 echo "<option value=\"$template_filename\">$template_name</option>"; 137 } 138 echo '</select></td>'; 139 } 140 ?> 127 141 <td><input onclick="sc_add_page();" type="button" class="button-secondary" value="Add Page" /></td> 128 142 </tr> -
bulk-page-creator/trunk/my-script.js
r799716 r1050490 69 69 } 70 70 var parent = jQuery('#page_id').val(); 71 var template = jQuery('#page_template').val(); 72 var template_text = jQuery('#page_template option[value="'+ template +'"]').text(); 73 if(!template) template = ''; 74 if(!template_text) template_text = ''; 75 71 76 if(parent==''){ 72 77 parent = -1; 73 jQuery('ul.sc-pages').append('<li class="page-item-new' + pageid + '">' + jQuery('#sc-page-name').val() + ' <a href="JavaScript:sc_del_page(' + pageid + ');">Remove</a></li>');78 jQuery('ul.sc-pages').append('<li class="page-item-new' + pageid + '">' + jQuery('#sc-page-name').val() + (template!='' ? ' (' + template_text + ')' : '') + ' <a href="JavaScript:sc_del_page(' + pageid + ');">Remove</a></li>'); 74 79 jQuery('#page_id').append('<option value="new' + pageid + '">' + jQuery('#sc-page-name').val() + '</option>'); 75 80 }else{ … … 82 87 } 83 88 } 84 jQuery('li.page-item-' + parent).append('<li class="page-item-new' + pageid + '">' + jQuery('#sc-page-name').val() + ' <a href="JavaScript:sc_del_page(' + pageid + ');">Remove</a></li>');89 jQuery('li.page-item-' + parent).append('<li class="page-item-new' + pageid + '">' + jQuery('#sc-page-name').val() + (template!='' ? ' (' + template_text + ')' : '') + ' <a href="JavaScript:sc_del_page(' + pageid + ');">Remove</a></li>'); 85 90 jQuery('#page_id option[value=' + parent + ']').after('<option class="p_' + parent + '" value="new' + pageid + '">' + parentspace + jQuery('#sc-page-name').val() + '</option>'); 86 91 } 87 jQuery('#sc-pages').val(jQuery('#sc-pages').val() + pageid + '|' + parent + '|' + jQuery('#sc-page-name').val() + ' \n');92 jQuery('#sc-pages').val(jQuery('#sc-pages').val() + pageid + '|' + parent + '|' + jQuery('#sc-page-name').val() + '|' + template + '\n'); 88 93 89 94 //reset the form -
bulk-page-creator/trunk/readme.txt
r799716 r1050490 3 3 Tags: Solid Code, Dagan Lev, Bulk Page Creator, batch action, add pages, add posts 4 4 Requires at least: 3.1 5 Tested up to: 3.15 Tested up to: 4.1 6 6 Stable tag: trunk 7 7 … … 44 44 Added script to add pages in the page section when accedently submitting form 45 45 46 = 1.0.8 = 47 Added template support - if templates exist in the theme will create a template dropdown to choose from when adding pages 48 46 49 == Screenshots == 47 50 48 51 1. View of bulk page creator screen 52 53 == Upgrade Notice == 54 55 Added template support - if templates exist in the theme will create a template dropdown to choose from when adding pages
Note: See TracChangeset
for help on using the changeset viewer.