| 1 |
<?php |
| 2 |
// Grid should never be null. Construct just allows easy access to WPUPG_Grid functions in IDE. |
| 3 |
if( is_null( $grid ) ) $grid = new WPUPG_Grid(0); |
| 4 |
$premium_only = WPUltimatePostGrid::is_premium_active() ? '' : ' (' . __( 'Premium only', 'wp-ultimate-post-grid' ) . ')'; |
| 5 |
?> |
| 6 |
|
| 7 |
<table id="wpupg_form_data_source_terms" class="wpupg_form"> |
| 8 |
<tr class="wpupg_type_terms"> |
| 9 |
<td><label for="wpupg_taxonomies"><?php _e( 'Taxonomies', 'wp-ultimate-post-grid' ); ?></label></td> |
| 10 |
<td> |
| 11 |
<select name="wpupg_taxonomies" id="wpupg_taxonomies" class="wpupg-select2"> |
| 12 |
<?php |
| 13 |
$taxonomies = get_taxonomies( '', 'objects' ); |
| 14 |
|
| 15 |
foreach( $taxonomies as $taxonomy => $options ) { |
| 16 |
$selected = in_array( $taxonomy, $grid->taxonomies() ) ? ' selected="selected"' : ''; |
| 17 |
echo '<option value="' . esc_attr( $taxonomy ) . '"' . $selected . '>' . $options->labels->name . '</option>'; |
| 18 |
} |
| 19 |
?> |
| 20 |
</select> |
| 21 |
</td> |
| 22 |
<td><?php _e( 'Taxonomies to be displayed in the grid.', 'wp-ultimate-post-grid' ); ?></td> |
| 23 |
</tr> |
| 24 |
<tr class="wpupg_divider"> |
| 25 |
<td><label for="wpupg_terms_order_by"><?php _e( 'Order By', 'wp-ultimate-post-grid' ); ?></label></td> |
| 26 |
<td> |
| 27 |
<select name="wpupg_terms_order_by" id="wpupg_terms_order_by" class="wpupg-select2"> |
| 28 |
<?php |
| 29 |
$order_by_options = array( |
| 30 |
'name' => __( 'Name', 'wp-ultimate-post-grid' ), |
| 31 |
'slug' => __( 'Slug', 'wp-ultimate-post-grid' ), |
| 32 |
'term_id' => __( 'ID', 'wp-ultimate-post-grid' ), |
| 33 |
'description' => __( 'Description', 'wp-ultimate-post-grid' ), |
| 34 |
'count' => __( 'Post Count', 'wp-ultimate-post-grid' ), |
| 35 |
); |
| 36 |
|
| 37 |
foreach( $order_by_options as $order_by => $order_by_name ) { |
| 38 |
$selected = $order_by == $grid->terms_order_by() ? ' selected="selected"' : ''; |
| 39 |
echo '<option value="' . esc_attr( $order_by ) . '"' . $selected . '>' . $order_by_name . '</option>'; |
| 40 |
} |
| 41 |
?> |
| 42 |
</select> |
| 43 |
</td> |
| 44 |
<td><?php _e( 'How to order the items in the grid.', 'wp-ultimate-post-grid' ); ?></td> |
| 45 |
</tr> |
| 46 |
<tr> |
| 47 |
<td><label for="wpupg_terms_order"><?php _e( 'Order', 'wp-ultimate-post-grid' ); ?></label></td> |
| 48 |
<td> |
| 49 |
<select name="wpupg_terms_order" id="wpupg_terms_order" class="wpupg-select2"> |
| 50 |
<?php |
| 51 |
$order_options = array( |
| 52 |
'asc' => __( 'Ascending', 'wp-ultimate-post-grid' ), |
| 53 |
'desc' => __( 'Descending', 'wp-ultimate-post-grid' ), |
| 54 |
); |
| 55 |
|
| 56 |
foreach( $order_options as $order => $order_name ) { |
| 57 |
$selected = $order == $grid->terms_order() ? ' selected="selected"' : ''; |
| 58 |
echo '<option value="' . esc_attr( $order ) . '"' . $selected . '>' . $order_name . '</option>'; |
| 59 |
} |
| 60 |
?> |
| 61 |
</select> |
| 62 |
</td> |
| 63 |
<td> </td> |
| 64 |
</tr> |
| 65 |
<tr class="wpupg_divider"> |
| 66 |
<td><label for="wpupg_terms_hide_empty"><?php _e( 'Hide Empty', 'wp-ultimate-post-grid' ); ?></label></td> |
| 67 |
<td> |
| 68 |
<input type="checkbox" name="wpupg_terms_hide_empty" id="wpupg_terms_hide_empty" <?php if( $grid->terms_hide_empty() ) echo 'checked="true" '?>/> |
| 69 |
</td> |
| 70 |
<td><?php _e( 'Hide terms without associated posts.', 'wp-ultimate-post-grid' ); ?></td> |
| 71 |
</tr> |
| 72 |
<tr> |
| 73 |
<td><label for="wpupg_terms_images_only"><?php _e( 'Images Only', 'wp-ultimate-post-grid' ); ?></label></td> |
| 74 |
<td> |
| 75 |
<input type="checkbox" name="wpupg_terms_images_only" id="wpupg_terms_images_only" <?php if( $grid->terms_images_only() ) echo 'checked="true" '?>/> |
| 76 |
</td> |
| 77 |
<td><?php _e( 'Only display items with a featured image.', 'wp-ultimate-post-grid' ); ?></td> |
| 78 |
</tr> |
| 79 |
<tr class="wpupg_divider"> |
| 80 |
<td><label for="wpupg_limit_terms"><?php _e( 'Limit Terms', 'wp-ultimate-post-grid' ); ?></label></td> |
| 81 |
<td> |
| 82 |
<input type="checkbox" name="wpupg_limit_terms" id="wpupg_limit_terms" <?php if( $grid->limit_terms() ) echo 'checked="true" '?>/> |
| 83 |
<?php echo $premium_only; ?> |
| 84 |
</td> |
| 85 |
<td><?php _e( 'Limit the terms that will be shown in the grid.', 'wp-ultimate-post-grid' ); ?></td> |
| 86 |
</tr> |
| 87 |
</table> |