| 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 |
?> |
| 5 |
|
| 6 |
<table id="wpupg_form_grid" class="wpupg_form"> |
| 7 |
<tr> |
| 8 |
<td><label for="wpupg_link_type"><?php _e( 'Links', 'wp-ultimate-post-grid' ); ?></label></td> |
| 9 |
<td> |
| 10 |
<select name="wpupg_link_type" id="wpupg_link_type" class="wpupg-select2"> |
| 11 |
<?php |
| 12 |
$link_type_options = array( |
| 13 |
'_self' => __( 'Open in same tab', 'wp-ultimate-post-grid' ), |
| 14 |
'_blank' => __( 'Open in new tab', 'wp-ultimate-post-grid' ), |
| 15 |
'none' => __( "Don't use links", 'wp-ultimate-post-grid' ), |
| 16 |
); |
| 17 |
|
| 18 |
foreach( $link_type_options as $link_type => $link_type_name ) { |
| 19 |
$selected = $link_type == $grid->link_type() ? ' selected="selected"' : ''; |
| 20 |
echo '<option value="' . esc_attr( $link_type ) . '"' . $selected . '>' . $link_type_name . '</option>'; |
| 21 |
} |
| 22 |
?> |
| 23 |
</select> |
| 24 |
</td> |
| 25 |
<td><?php _e( 'Options for links surrounding the grid items.', 'wp-ultimate-post-grid' ); ?></td> |
| 26 |
</tr> |
| 27 |
<tr> |
| 28 |
<td><label for="wpupg_link_target"><?php _e( 'Link to', 'wp-ultimate-post-grid' ); ?></label></td> |
| 29 |
<td> |
| 30 |
<select name="wpupg_link_target" id="wpupg_link_target" class="wpupg-select2"> |
| 31 |
<?php |
| 32 |
$link_target_options = array( |
| 33 |
'post' => __( 'Post', 'wp-ultimate-post-grid' ), |
| 34 |
'image' => __( 'Featured Image', 'wp-ultimate-post-grid' ), |
| 35 |
); |
| 36 |
|
| 37 |
foreach( $link_target_options as $link_target => $link_target_name ) { |
| 38 |
$selected = $link_target == $grid->link_target() ? ' selected="selected"' : ''; |
| 39 |
echo '<option value="' . esc_attr( $link_target ) . '"' . $selected . '>' . $link_target_name . '</option>'; |
| 40 |
} |
| 41 |
?> |
| 42 |
</select> |
| 43 |
</td> |
| 44 |
<td><?php _e( 'Options for links surrounding the grid items.', 'wp-ultimate-post-grid' ); ?></td> |
| 45 |
</tr> |
| 46 |
<tr class="wpupg_divider"> |
| 47 |
<td><label for="wpupg_template"><?php _e( 'Template', 'wp-ultimate-post-grid' ); ?></label></td> |
| 48 |
<td> |
| 49 |
<select name="wpupg_template" id="wpupg_template" class="wpupg-select2"> |
| 50 |
<?php |
| 51 |
$templates = WPUltimatePostGrid::addon( 'custom-templates' )->get_mapping(); |
| 52 |
$templates = apply_filters( 'wpupg_meta_box_grid_templates', $templates ); |
| 53 |
|
| 54 |
foreach ( $templates as $index => $template ) { |
| 55 |
$selected = $index == $grid->template_id() ? ' selected="selected"' : ''; |
| 56 |
echo '<option value="' . esc_attr( $index ) . '"' . $selected . '>' . $template . '</option>'; |
| 57 |
} |
| 58 |
?> |
| 59 |
</select> |
| 60 |
</td> |
| 61 |
<td><?php _e( 'Template to be used for grid items.', 'wp-ultimate-post-grid' ); ?></td> |
| 62 |
</tr> |
| 63 |
<tr> |
| 64 |
<td><label for="wpupg_layout_mode"><?php _e( 'Layout Mode', 'wp-ultimate-post-grid' ); ?></label></td> |
| 65 |
<td> |
| 66 |
<select name="wpupg_layout_mode" id="wpupg_layout_mode" class="wpupg-select2"> |
| 67 |
<?php |
| 68 |
$layout_mode_options = array( |
| 69 |
'masonry' => __( 'Masonry (Pinterest like)', 'wp-ultimate-post-grid' ), |
| 70 |
'fitRows' => __( 'Items in rows', 'wp-ultimate-post-grid' ), |
| 71 |
); |
| 72 |
|
| 73 |
foreach( $layout_mode_options as $layout_mode => $layout_mode_name ) { |
| 74 |
$selected = $layout_mode == $grid->layout_mode() ? ' selected="selected"' : ''; |
| 75 |
echo '<option value="' . esc_attr( $layout_mode ) . '"' . $selected . '>' . $layout_mode_name . '</option>'; |
| 76 |
} |
| 77 |
?> |
| 78 |
</select> |
| 79 |
</td> |
| 80 |
<td><?php _e( 'Options for links surrounding the grid items.', 'wp-ultimate-post-grid' ); ?></td> |
| 81 |
</tr> |
| 82 |
<tr class="wpupg_masonry"> |
| 83 |
<td><label for="wpupg_centered"><?php _e( 'Center Grid', 'wp-ultimate-post-grid' ); ?></label></td> |
| 84 |
<td> |
| 85 |
<input type="checkbox" name="wpupg_centered" id="wpupg_centered" <?php if( $grid->centered() ) echo 'checked="true" '?>/> |
| 86 |
</td> |
| 87 |
<td><?php _e( 'Center the entire grid.', 'wp-ultimate-post-grid' ); ?></td> |
| 88 |
</tr> |
| 89 |
<tr class="wpupg_divider"> |
| 90 |
<td><label for="wpupg_empty_message"><?php _e( 'Empty Message', 'wp-ultimate-post-grid' ); ?></label></td> |
| 91 |
<td> |
| 92 |
<?php |
| 93 |
$options = array( |
| 94 |
'textarea_rows' => 5, |
| 95 |
'media_buttons' => false, |
| 96 |
'teeny' => true, |
| 97 |
); |
| 98 |
|
| 99 |
wp_editor( $grid->empty_message(), 'wpupg_empty_message', $options ); |
| 100 |
?> |
| 101 |
</td> |
| 102 |
<td><?php _e( 'Message to show when there are no items to display.', 'wp-ultimate-post-grid' ); ?></td> |
| 103 |
</tr> |
| 104 |
</table> |