| 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" class="wpupg_form"> |
| 8 |
<tr> |
| 9 |
<td><label for="wpupg_post_types"><?php _e( 'Post Types', 'wp-ultimate-post-grid' ); ?></label></td> |
| 10 |
<td> |
| 11 |
<select name="wpupg_post_types" id="wpupg_post_types" class="wpupg-select2"> |
| 12 |
<?php |
| 13 |
$post_types = get_post_types( '', 'objects' ); |
| 14 |
|
| 15 |
unset( $post_types[WPUPG_POST_TYPE] ); |
| 16 |
unset( $post_types['revision'] ); |
| 17 |
unset( $post_types['nav_menu_item'] ); |
| 18 |
|
| 19 |
foreach( $post_types as $post_type => $options ) { |
| 20 |
$selected = in_array( $post_type, $grid->post_types() ) ? ' selected="selected"' : ''; |
| 21 |
echo '<option value="' . esc_attr( $post_type ) . '"' . $selected . '>' . $options->labels->name . '</option>'; |
| 22 |
} |
| 23 |
?> |
| 24 |
</select> |
| 25 |
</td> |
| 26 |
<td><?php _e( 'Post types to be displayed in the grid.', 'wp-ultimate-post-grid' ); ?></td> |
| 27 |
</tr> |
| 28 |
<tr class="wpupg_divider"> |
| 29 |
<td><label for="wpupg_order_by"><?php _e( 'Order By', 'wp-ultimate-post-grid' ); ?></label></td> |
| 30 |
<td> |
| 31 |
<select name="wpupg_order_by" id="wpupg_order_by" class="wpupg-select2"> |
| 32 |
<?php |
| 33 |
$order_by_options = array( |
| 34 |
'title' => __( 'Title', 'wp-ultimate-post-grid' ), |
| 35 |
'date' => __( 'Date', 'wp-ultimate-post-grid' ), |
| 36 |
'rand' => __( 'Random', 'wp-ultimate-post-grid' ), |
| 37 |
'menu_order' => __( 'Menu Order (pages)', 'wp-ultimate-post-grid' ), |
| 38 |
'custom' => __( 'Custom Key', 'wp-ultimate-post-grid' ) . $premium_only, |
| 39 |
); |
| 40 |
|
| 41 |
foreach( $order_by_options as $order_by => $order_by_name ) { |
| 42 |
$selected = $order_by == $grid->order_by() ? ' selected="selected"' : ''; |
| 43 |
echo '<option value="' . esc_attr( $order_by ) . '"' . $selected . '>' . $order_by_name . '</option>'; |
| 44 |
} |
| 45 |
?> |
| 46 |
</select> |
| 47 |
</td> |
| 48 |
<td><?php _e( 'How to order the items in the grid.', 'wp-ultimate-post-grid' ); ?></td> |
| 49 |
</tr> |
| 50 |
<tr> |
| 51 |
<td><label for="wpupg_order"><?php _e( 'Order', 'wp-ultimate-post-grid' ); ?></label></td> |
| 52 |
<td> |
| 53 |
<select name="wpupg_order" id="wpupg_order" class="wpupg-select2"> |
| 54 |
<?php |
| 55 |
$order_options = array( |
| 56 |
'asc' => __( 'Ascending', 'wp-ultimate-post-grid' ), |
| 57 |
'desc' => __( 'Descending', 'wp-ultimate-post-grid' ), |
| 58 |
); |
| 59 |
|
| 60 |
foreach( $order_options as $order => $order_name ) { |
| 61 |
$selected = $order == $grid->order() ? ' selected="selected"' : ''; |
| 62 |
echo '<option value="' . esc_attr( $order ) . '"' . $selected . '>' . $order_name . '</option>'; |
| 63 |
} |
| 64 |
?> |
| 65 |
</select> |
| 66 |
</td> |
| 67 |
<td> </td> |
| 68 |
</tr> |
| 69 |
<tr class="wpupg_order_custom_key_container"> |
| 70 |
<td><label for="wpupg_order_custom_key"><?php _e( 'Custom Key', 'wp-ultimate-post-grid' ); ?></label></td> |
| 71 |
<td> |
| 72 |
<input type="text" name="wpupg_order_custom_key" id="wpupg_order_custom_key" value="<?php echo $grid->order_custom_key(); ?>"/> |
| 73 |
</td> |
| 74 |
<td><?php _e( 'Custom key to order the grid by.', 'wp-ultimate-post-grid' ); ?></td> |
| 75 |
</tr> |
| 76 |
<tr class="wpupg_order_custom_key_container"> |
| 77 |
<td><label for="wpupg_order_custom_key_numeric"><?php _e( 'Numeric Order', 'wp-ultimate-post-grid' ); ?></label></td> |
| 78 |
<td> |
| 79 |
<input type="checkbox" name="wpupg_order_custom_key_numeric" id="wpupg_order_custom_key_numeric" <?php if( $grid->order_custom_key_numeric() ) echo 'checked="true" '?>/> |
| 80 |
</td> |
| 81 |
<td><?php _e( 'Enable if the custom field contains numbers.', 'wp-ultimate-post-grid' ); ?></td> |
| 82 |
</tr> |
| 83 |
<tr class="wpupg_divider"> |
| 84 |
<td><label for="wpupg_images_only"><?php _e( 'Images Only', 'wp-ultimate-post-grid' ); ?></label></td> |
| 85 |
<td> |
| 86 |
<input type="checkbox" name="wpupg_images_only" id="wpupg_images_only" <?php if( $grid->images_only() ) echo 'checked="true" '?>/> |
| 87 |
</td> |
| 88 |
<td><?php _e( 'Only display items with a featured image.', 'wp-ultimate-post-grid' ); ?></td> |
| 89 |
</tr> |
| 90 |
<tr class="wpupg_divider"> |
| 91 |
<td><label for="wpupg_limit_posts_offset"><?php _e( 'Offset Items', 'wp-ultimate-post-grid' ); ?></label></td> |
| 92 |
<td> |
| 93 |
<input type="number" name="wpupg_limit_posts_offset" id="wpupg_limit_posts_offset" value="<?php echo $grid->limit_posts_offset(); ?>"/> |
| 94 |
</td> |
| 95 |
<td><?php _e( 'Exclude the first x items from the grid.', 'wp-ultimate-post-grid' ); ?></td> |
| 96 |
</tr> |
| 97 |
<tr> |
| 98 |
<td><label for="wpupg_limit_posts_number"><?php _e( 'Limit Total # Items', 'wp-ultimate-post-grid' ); ?></label></td> |
| 99 |
<td> |
| 100 |
<input type="number" min="1" name="wpupg_limit_posts_number" id="wpupg_limit_posts_number" value="<?php echo $grid->limit_posts_number(); ?>"/> |
| 101 |
</td> |
| 102 |
<td><?php _e( 'Limit the total number of items in the grid.', 'wp-ultimate-post-grid' ); ?></td> |
| 103 |
</tr> |
| 104 |
<tr> |
| 105 |
<td><label for="wpupg_limit_posts"><?php _e( 'Limit Items', 'wp-ultimate-post-grid' ); ?></label></td> |
| 106 |
<td> |
| 107 |
<input type="checkbox" name="wpupg_limit_posts" id="wpupg_limit_posts" <?php if( $grid->limit_posts() ) echo 'checked="true" '?>/> |
| 108 |
<?php echo $premium_only; ?> |
| 109 |
</td> |
| 110 |
<td><?php _e( 'Limit the items that will be shown in the grid.', 'wp-ultimate-post-grid' ); ?></td> |
| 111 |
</tr> |
| 112 |
</table> |