WordPress插件制作教程(一) | 周良博客
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | <!--?php <br ?--> function test(){ global $wpdb; $table_name = $wpdb->prefix . "mood"; $fivesdrafts = $wpdb->get_results( " SELECT id, createdon, publishedon,status,mood,text,address FROM $table_name ORDER BY createdon DESC " ); ?> <div id="my-mood">foreach ( $fivesdrafts as $fivesdraft ) { ?> } ?> <table class="widefat"> <thead> <tr> <th>������������</th> <th>���������������</th> <th>������</th> <th>������������</th> <th>������</th> </tr> </thead> <tfoot> <tr> <th>������������</th> <th>���������������</th> <th>������</th> <th>������������</th> <th>������</th> </tr> </tfoot> <tbody> <tr> <td><input name="text" type="text" value="" placeholder="������������������" /></td> <td><input name="address" type="text" value="" placeholder="���������������������" /></td> <td><label>���������<input class="mood" checked="checked" name="mood" type="radio" value="0" /></label> <label>���������<input class="mood" name="mood" type="radio" value="1" /></label> <label>���������<input class="mood" name="mood" type="radio" value="2" /></label> <label>���������<input class="mood" name="mood" type="radio" value="3" /></label> <label>���������<input class="mood" name="mood" type="radio" value="4" /></label></td> <td></td> <td><a class="add">������</a></td> </tr> <!--?php <br ?--> <tr> <td><input name="text" type="text" value="'<?php" />text; ?>'/></td> <td><input name="address" type="text" value="'<?php" />address; ?>'/></td> <td><label>���������<input class="mood" name="mood<?php echo $fivesdraft->id; ?>" type="radio" />mood==0?'checked=checked':''; ?> value="0"></label> <label>���������<input class="mood" name="mood<?php echo $fivesdraft->id; ?>" type="radio" />mood=='1'?'checked=checked':''; ?> value="1"></label> <label>���������<input class="mood" name="mood<?php echo $fivesdraft->id; ?>" type="radio" />mood==2?'checked=checked':''; ?> value="2"></label> <label>���������<input class="mood" name="mood<?php echo $fivesdraft->id; ?>" type="radio" />mood==3?'checked=checked':''; ?> value="3"></label> <label>���������<input class="mood" name="mood<?php echo $fivesdraft->id; ?>" type="radio" />mood==4?'checked=checked':''; ?> value="4"></label></td> <td></td> <td><a class="edit">������</a><a class="delete">������</a></td> </tr> <!--?php <br ?--></tbody> </table> </div> <!--?php <br ?--> } ?> |