function __construct($id = 0) { $data = get_post_meta($id); $this->ID = $id; $this->link = isset($data['informacion_link']) ? reset($data['informacion_link']) : false; $this->img = isset($data['informacion_logo']) ? _processed_value(reset($data['informacion_logo']), 'image_media') : false; }
function __construct($id = 0) { $data = get_post_meta($id); $this->ID = $id; $this->fecha = strtotime(get_post_field('post_date', $this->ID)); $this->titulo = get_the_title($this->ID); $this->texto = apply_filters('the_content', get_post_field('post_content', $this->ID)); $this->subtitulo = isset($data['informacion_subtitulo']) ? reset($data['informacion_subtitulo']) : false; $this->link_externo = isset($data['informacion_link']) ? reset($data['informacion_link']) : false; $this->img = isset($data['informacion_imagen']) ? _processed_value(reset($data['informacion_imagen']), 'image_media') : false; }
function __construct($id = false) { if (!$id) { return; } $this->ID = $id; $meta = get_post_meta($this->ID); $this->nombre = get_the_title($this->ID); $this->foto = isset($meta['extras_foto']) ? _processed_value(reset($meta['extras_foto']), 'image_media') : false; $this->desc = isset($meta['extras_descripcion']) ? reset($meta['extras_descripcion']) : false; }
function __construct($id = false) { if (!$id) { return; } $this->ID = $id; $data = get_post_meta($this->ID); $this->timestamp = get_the_date('Y-m-d H:i:s', $this->ID); $this->titulo = get_the_title($this->ID); $this->foto = isset($data['informacion_imagen']) ? _processed_value(reset($data['informacion_imagen']), 'image_media') : false; $this->precio = isset($data['informacion_precio']) ? reset($data['informacion_precio']) : false; }
function get_group($group_name, $post_id = NULL) { global $post, $wpdb; if (!$post_id) { $post_id = $post->ID; } $sql = sprintf("SELECT m.field_name, c.type, w.meta_value, m.group_count, m.field_count, c.options " . "FROM %s m " . "JOIN %s c ON m.field_name = c.name " . "JOIN %s g ON c.custom_group_id = g.id " . "JOIN %s w ON w.meta_id = m.meta_id " . "WHERE m.post_id = %d AND g.name = '%s' AND w.meta_value <> '' " . "ORDER BY m.group_count,c.display_order, m.field_count ASC", MF_TABLE_POST_META, MF_TABLE_CUSTOM_FIELDS, MF_TABLE_CUSTOM_GROUPS, $wpdb->postmeta, $post_id, $group_name); $fields = $wpdb->get_results($sql, ARRAY_A); $result = array(); foreach ($fields as $field) { $type = $field['type']; $options = $field['options']; $value = $field['meta_value']; $group_index = $field['group_count']; $field_index = $field['field_count']; $field_name = $field['field_name']; if (is_serialized($value)) { $value = unserialize($value); } $result[$group_index][$field_name][$field_index] = _processed_value($value, $type, $options, 1); } return $result; }
private function set_about($meta = false) { if (!$meta) { return false; } $autor = array('nombre' => isset($meta['about_nombre']) ? reset($meta['about_nombre']) : false, 'subtitulo' => isset($meta['about_subtitulo']) ? reset($meta['about_subtitulo']) : false, 'foto' => isset($meta['about_imagen']) ? _processed_value(reset($meta['about_imagen']), 'image_media') : false); if (!$autor['nombre'] || !$autor['foto']) { return false; } $autor['contacto'] = array('email' => isset($meta['about_e_mail']) ? reset($meta['about_e_mail']) : false, 'telefono' => isset($meta['about_telefono']) ? reset($meta['about_telefono']) : false); $autor['redes'] = array('facebook' => isset($meta['about_facebook']) ? reset($meta['about_facebook']) : false, 'twitter' => isset($meta['about_twitter']) ? reset($meta['about_twitter']) : false, 'instagram' => isset($meta['about_instagram']) ? reset($meta['about_instagram']) : false); return $autor; }
/** * Recibe un loop de imagenes * @return \Closure */ protected static final function FuncionImagenes() { return function ($clase, $propiedad) { $data = array(); foreach ((array) $clase->{$propiedad} as $elemento) { $data[] = _processed_value($elemento, 'image_media'); } return $data; }; }