Changeset 586917
- Timestamp:
- 08/17/2012 05:04:18 PM (14 years ago)
- Location:
- widget-pagination/trunk
- Files:
-
- 2 edited
-
inc/wgpag-options.php (modified) (2 diffs)
-
js/admin.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
widget-pagination/trunk/inc/wgpag-options.php
r586897 r586917 42 42 <p><?php _e("If you want a pagination, enter the designated items per page for each widget. Otherwise, leave it emtpy.", 'wgpag') ?></p> 43 43 44 <table class="form-table" >44 <table class="form-table" id="items_per_page"> 45 45 <?php 46 46 foreach ($this->widgets as $w => $name) : … … 61 61 </tr> 62 62 <?php endforeach; ?> 63 64 <tr> 65 <th for=""> 66 <?php _e("Custom Widgets", 'wgpag') ?> 67 </th> 68 <td> 69 <select id="wgpag-customwidget" name="wgpag-customwidget"> 70 <option value=""><?php _e("please chose", 'wgpag') ?></option> 71 <option value="widget_views">WP PostViews</option> 72 </select> 73 </td> 74 </tr> 63 75 </table> 64 76 </div><!-- /postbox --> -
widget-pagination/trunk/js/admin.js
r500612 r586917 23 23 }); 24 24 25 // Add custom widgets 26 $('#wgpag-customwidget').change(function() { 27 // clone a row with a standard widget 28 var customWidget = jQuery('#items_per_page tr').first().clone(); 29 30 //console.log(customwidget); 31 32 // append it 33 jQuery('#items_per_page').append(customWidget); 34 35 var widgetName = $(this).find("option:selected").text(); 36 var widgetID = $(this).val(); 37 38 // change label and value and id and name 39 customWidget.find('label').html(widgetName); //LABEL text 40 customWidget.find('input').attr('name', 'wgpag-items_per_page_' + widgetID); //INPUT name 41 customWidget.find('input').attr('id', 'wgpag-items_per_page_' + widgetID); //INPUT id 42 customWidget.find('input').val(''); //empty value 43 customWidget.find('span').remove(); //remove hint 44 45 // disable selected option and reset dropdown 46 $(this).find("option:selected").attr("disabled","disabled"); 47 $(this).val(''); 48 49 }); 50 25 51 });
Note: See TracChangeset
for help on using the changeset viewer.