public function getFirstTerm($taxonomy) { empty($this->_terms[$taxonomy]) and $this->_terms[$taxonomy] = get_the_terms(get_the_ID(), $taxonomy); if (!empty($this->_terms[$taxonomy])) { return \Morepress\Term::forge($this->_terms[$taxonomy][0]); } }
public function callback($term = null) { if (!empty($term)) { $mp_term = \Morepress\Term::forge($term); ?> <tr class="form-field"> <th scope="row" valign="top"> <label for="term_meta_<?php echo $this->_slug; ?> "><?php echo $this->_params['label']; ?> </label> </th> <td> <select id="term_meta_<?php echo $this->_slug; ?> " name="term_meta[<?php echo $this->_slug; ?> ]" id="term_meta_<?php echo $this->_slug; ?> "> <?php foreach ($this->_params['options'] as $key => $value) { ?> <option <?php echo $key == $mp_term->getMeta($this->_slug, true) ? 'selected' : ''; ?> value="<?php echo $key; ?> "><?php echo $value; ?> </option> <?php } ?> </select> <?php if (!empty($this->_params['description'])) { ?> <p class="description"><?php echo $this->_params['description']; ?> </p> <?php } ?> </td> </tr> <?php } }
public function callback($term = null) { if (!empty($term)) { $mp_term = \Morepress\Term::forge($term); $meta = $mp_term->getMeta('page', true); empty($meta) or $post = get_post($meta); ?> <tr class="form-field"> <th scope="row" valign="top"> <label for="term_meta_<?php echo $this->_slug; ?> "><?php echo $this->_params['label']; ?> </label> </th> <td> <input data-callback="<?php echo $this->_slug; ?> " type="text" class="morepress_post_list" id="term_meta_<?php echo $this->_slug; ?> " value="<?php echo isset($post->post_title) ? esc_attr($post->post_title) : ''; ?> " placeholder="Commencez à tapper..."> <input type="hidden" value="<?php echo isset($post->ID) ? $post->ID : ''; ?> " name="term_meta[<?php echo $this->_slug; ?> ]"> <?php if (!empty($this->_params['description'])) { ?> <p class="description"><?php echo $this->_params['description']; ?> </p> <?php } ?> </td> </tr> <?php } }
public function callback($term = null) { if (!empty($term)) { $mp_term = \Morepress\Term::forge($term); ?> <tr class="form-field"> <th scope="row" valign="top"> <label for="term_meta_<?php echo $this->_slug; ?> "><?php echo $this->_params['label']; ?> </label> </th> <td> <label for="term_meta_<?php echo $this->_slug; ?> "> <input name="term_meta[<?php echo $this->_slug; ?> ]" type="hidden" value="0"> <input <?php echo $mp_term->getMeta($this->_slug, true) ? ' checked' : ''; ?> id="term_meta_<?php echo $this->_slug; ?> " name="term_meta[<?php echo $this->_slug; ?> ]" type="checkbox" value="1"> <?php if (!empty($this->_params['description'])) { ?> <?php echo $this->_params['description']; ?> <?php } ?> </label> </td> </tr> <?php } }
public function callback($term = null) { if (!empty($term)) { $mp_term = \Morepress\Term::forge($term); ?> <tr class="form-field"> <th scope="row" valign="top"> <label for="term_meta_<?php echo $this->_slug; ?> "><?php echo $this->_params['label']; ?> </label> </th> <td> <select id="term_meta_<?php echo $this->_slug; ?> " name="term_meta[<?php echo $this->_slug; ?> ]" id="term_meta_<?php echo $this->_slug; ?> "> <?php wp_dropdown_roles($mp_term->getMeta($this->_slug)); ?> </select> <?php if (!empty($this->_params['description'])) { ?> <p class="description"><?php echo $this->_params['description']; ?> </p> <?php } ?> </td> </tr> <?php } }
public function callback($term = null) { if (!empty($term)) { $mp_term = \Morepress\Term::forge($term); ?> <tr class="form-field"> <th scope="row" valign="top"> <label for="term_meta_<?php echo $this->_slug; ?> "><?php echo $this->_params['label']; ?> </label> </th> <td> <input id="term_meta_<?php echo $this->_slug; ?> " name="term_meta[<?php echo $this->_slug; ?> ]" type="text" value="<?php echo esc_attr($mp_term->getMeta($this->_slug, true)); ?> "> <?php if (!empty($this->_params['description'])) { ?> <p class="description"><?php echo $this->_params['description']; ?> </p> <?php } ?> </td> </tr> <?php } }
public function callback($term = null) { if (!empty($term)) { $mp_term = \Morepress\Term::forge($term); ?> <tr class="form-field"> <th scope="row" valign="top"> <label for="term_meta[<?php echo $this->_slug; ?> ]"><?php echo $this->_params['label']; ?> </label> </th> <td> <input type="hidden" name="term_meta_editor[]" value="<?php echo $this->_slug; ?> "> <?php wp_editor($mp_term->getMeta($this->_slug), $this->_slug, $this->_params['settings']); ?> <?php if (!empty($this->_params['description'])) { ?> <p class="description"><?php echo $this->_params['description']; ?> </p> <?php } ?> </td> </tr> <?php } }
public function callback($term = null) { if (!empty($term)) { $mp_term = \Morepress\Term::forge($term); $args = array('id' => 'term_meta_' . $this->_slug, 'name' => 'term_meta[' . $this->_slug . ']', 'selected' => $mp_term->getMeta($this->_slug, true)); empty($this->_params['args']) or $args = array_merge($args, $this->_params['args']); ?> <tr class="form-field"> <th scope="row" valign="top"> <label for="term_meta_<?php echo $this->_slug; ?> "><?php echo $this->_params['label']; ?> </label> </th> <td> <?php wp_dropdown_categories($args); ?> <?php if (!empty($this->_params['description'])) { ?> <p class="description"><?php echo $this->_params['description']; ?> </p> <?php } ?> </td> </tr> <?php } }
public function callback($term = null) { if (!empty($term)) { $mp_term = \Morepress\Term::forge($term); $value = $mp_term->getMeta($this->_slug, true); $image = null; if ($value) { $image = wp_get_attachment_image_src($value, 'original'); $image = $image[0]; } ?> <tr class="form-field form-field-image"> <th scope="row" valign="top"> <label for="term_meta_<?php echo $this->_slug; ?> "><?php echo $this->_params['label']; ?> </label> </th> <td> <input id="term_meta_<?php echo $this->_slug; ?> " name="term_meta[<?php echo $this->_slug; ?> ]" type="hidden" class="upload_image" value="<?php echo $value ? esc_attr($value) : ''; ?> "> <div class="upload_preview"> <img src="<?php echo $image; ?> " class="preview_image" height="150" alt=""> </div> <p class="hide-if-no-js"> <button class="upload_image_button button<?php echo $value ? ' hidden' : ''; ?> " type="button">Choisir une image</button> <button class="clear_image_button button<?php echo $value ? '' : ' hidden'; ?> " type="button">Supprimer l'image</button> </p> <?php if (!empty($this->_params['description'])) { ?> <p class="description"><?php echo $this->_params['description']; ?> </p> <?php } ?> </td> </tr> <?php } }