Beispiel #1
0
    /**
     * Add sub meta boxes to the post-edit page
     *
     * @since 1.0
     */
    function epl_meta_box_inner_custom_box($post, $args)
    {
        $groups = $args['args']['groups'];
        $groups = array_filter($groups);
        if (!empty($groups)) {
            wp_nonce_field('epl_inner_custom_box', 'epl_inner_custom_box_nonce');
            foreach ($groups as $group) {
                ?>
				<div class="epl-inner-div col-<?php 
                echo $group['columns'];
                ?>
 table-<?php 
                echo $args['args']['context'];
                ?>
">
					<?php 
                $group['label'] = trim($group['label']);
                if (!empty($group['label'])) {
                    echo '<h3>' . __($group['label'], 'epl') . '</h3>';
                }
                ?>
					<table class="form-table epl-form-table">
						<tbody>
							<?php 
                $fields = $group['fields'];
                $fields = array_filter($fields);
                if (!empty($fields)) {
                    foreach ($fields as $field) {
                        if (isset($field['exclude']) && !empty($field['exclude'])) {
                            if (in_array($post->post_type, $field['exclude'])) {
                                continue;
                            }
                        }
                        if (isset($field['include']) && !empty($field['include'])) {
                            if (!in_array($post->post_type, $field['include'])) {
                                continue;
                            }
                        }
                        ?>
										<tr class="form-field">
											<th valign="top" scope="row">
												<label for="<?php 
                        echo $field['name'];
                        ?>
"><?php 
                        _e($field['label'], 'epl');
                        ?>
</label>
											</th>
										
											<?php 
                        if ($group['columns'] > 1) {
                            ?>
												</tr><tr class="form-field">
											<?php 
                        }
                        ?>
										
											<td>
												<?php 
                        $val = get_post_meta($post->ID, $field['name'], true);
                        epl_render_html_fields($field, $val);
                        ?>
											</td>
										</tr>
									<?php 
                    }
                }
                ?>
						</tbody>
					</table>
				</div>
				<?php 
            }
            ?>
			<input type="hidden" name="epl_meta_box_ids[]" value="<?php 
            echo $args['id'];
            ?>
" />
			<div class="epl-clear"></div>
			<?php 
        }
    }
</h4>
														
													</div>
													<?php 
            }
            ?>
													<div class="<?php 
            echo $field['type'] == 'help' ? 'epl-full' : 'epl-half-right';
            ?>
">
														<?php 
            $val = '';
            if (isset($epl_settings[$field['name']])) {
                $val = $epl_settings[$field['name']];
            }
            epl_render_html_fields($field, $val);
            ?>
													</div>
												</div>
											</div>
										<?php 
        }
        ?>
									</div>
								</div>
							<?php 
    }
    ?>
						</div>
					<?php 
}