7
7
function lcp_settings () { // whitelist options
8
8
register_setting ( 'list_category_posts_group ' , 'numberposts ' );
9
9
register_setting ( 'list_category_posts_group ' , 'lcp_pagination ' );
10
+ register_setting ( 'list_category_posts_group ' , 'lcp_orderby ' );
11
+ register_setting ( 'list_category_posts_group ' , 'lcp_order ' );
10
12
}
11
13
12
14
function list_category_posts_menu () {
@@ -56,7 +58,7 @@ function list_category_posts_options() {
56
58
<tr valign="top">
57
59
<th scope="row">
58
60
<label for="lcp_pagination">
59
- <strong><?php _e ("Pagination " , "list-category-posts " ); ?> : </strong>
61
+ <strong><?php _e ("Pagination " , "list-category-posts " ); ?> </strong>
60
62
</label>
61
63
</th>
62
64
<td>
@@ -66,6 +68,54 @@ function list_category_posts_options() {
66
68
</select>
67
69
</td>
68
70
</tr>
71
+
72
+ <tr>
73
+ <th scope="row">
74
+ <label for="lcp_orderby">
75
+ <strong><?php _e ("Order by " , "list-category-posts " ); ?> </strong>
76
+ </label>
77
+ </th>
78
+ <td>
79
+ <select id="lcp_orderby" name="lcp_orderby" type="text" >
80
+ <?php
81
+ $ lcp_orders = array ("date " => __ ("Date " , "list-category-posts " ),
82
+ "modified " => __ ("Modified Date " , "list-category-posts " ),
83
+ "title " => __ ("Post title " , "list-category-posts " ),
84
+ "author " => __ ("Author " , "list-category-posts " ),
85
+ "rand " => __ ("Random " , "list-category-posts " ));
86
+ $ orderby = get_option ('lcp_orderby ' );
87
+ foreach ($ lcp_orders as $ key =>$ value ){
88
+ $ option = '<option value=" ' . $ key . '" ' ;
89
+ if ($ orderby == $ key ){
90
+ $ option .= ' selected = "selected" ' ;
91
+ }
92
+ $ option .= '> ' ;
93
+ echo $ option ;
94
+ _e ($ value , 'list-category-posts ' );
95
+ echo '</option> ' ;
96
+ }
97
+ ?>
98
+ </select>
99
+ </td>
100
+ </tr>
101
+
102
+ <th scope="row">
103
+ <label for="lcp_order">
104
+ <strong><?php _e ("Order " , "list-category-posts " ); ?> </strong>
105
+ </label>
106
+ </th>
107
+ <td>
108
+ <select id="lcp_order" name="lcp_order" type="text">
109
+ <?php $ order = get_option ('lcp_order ' ); ?>
110
+ <option value='desc' <?php if ($ order == 'desc ' ): echo "selected: selected " ; endif ;?> >
111
+ <?php _e ("Descending " , 'list-category-posts ' )?>
112
+ </option>
113
+ <option value='asc' <?php if ($ order == 'asc ' ): echo "selected: selected " ; endif ; ?> >
114
+ <?php _e ("Ascending " , 'list-category-posts ' )?>
115
+ </option>
116
+ </select>
117
+ </td>
118
+
69
119
</tbody>
70
120
</table>
71
121
<?php submit_button (); ?>
0 commit comments