/** * Prints the HTML markup for the 'Is This An Hotel?' metabox */ public static function metabox_html($post) { wp_nonce_field(__FILE__, self::META_KEY_NAME . '_nonce'); $value = get_post_meta($post->ID, self::META_KEY_NAME, true); echo HtmlHelper::input(self::META_KEY_NAME, 'checkbox', array('checked' => $value == 'on' ? 'checked' : '')); echo ' ' . HtmlHelper::label(__('Yes, this page is an Hotel!', 'wtu_framework'), self::META_KEY_NAME); }
public function _markup_checkbox_list($field, $values) { $input = ''; if (count($field['options'])) { foreach ($field['options'] as $key => $option) { $input .= HtmlHelper::input($this->metaname . '[' . $field['id'] . '][' . $key . ']', 'checkbox', array('id' => 'chebox-list-' . $field['id'] . '-' . $key, 'class' => '', 'checked' => empty($values[$field['id']][$key]) ? '' : 'checked')) . PHP_EOL . HtmlHelper::label($option, 'chebox-list-' . $field['id'] . '-' . $key) . PHP_EOL . HtmlHelper::br(); } } return $input; }
/** * Prints the metabox for the offer details * @param object $post the current post */ public function metabox_html($post) { wp_nonce_field(__FILE__, static::META_KEY_NAME . '_nonce'); $values = get_post_meta($post->ID, static::META_KEY_NAME, true); echo '<table class="form-table">'; foreach ($this->offer_details_list() as $k => $v) { $name = static::META_KEY_NAME . '[' . $v['name'] . ']'; echo '<tr>'; echo '<th>' . HtmlHelper::label($v['label'], $name) . '</th>'; echo '<td>' . HtmlHelper::input($name, 'text', array('value' => isset($values[$k]) ? $values[$k] : '')) . '</td>'; echo '</tr>'; } echo '</table>'; }