/** * Sets up and runs the functionality for getting the attachment meta. * * @since 1.0.0 * @access public * @param array $args * @return void */ public function __construct($args = array()) { $defaults = array('post_id' => get_the_ID(), 'labels' => array(), 'echo' => true); $this->args = apply_filters('hoot_media_meta_args', wp_parse_args($args, $defaults)); /* Get the attachment metadata. */ $this->meta = wp_get_attachment_metadata($this->args['post_id']); /* If the attachment is an image. */ if (wp_attachment_is_image($this->args['post_id'])) { $this->image_meta(); } elseif (hoot_attachment_is_audio($this->args['post_id'])) { $this->audio_meta(); } elseif (hoot_attachment_is_video($this->args['post_id'])) { $this->video_meta(); } }
/** * Creates custom labels for ID3 tags that are used on the front end of the site when displaying * media within the theme, typically on attachment pages. * * @since 1.0.0 * @access public * @param array $fields * @param object $attachment * @param string $context * @return array */ function hoot_attachment_id3_keys($fields, $attachment, $context) { if ('display' === $context) { $fields['filesize'] = __('File Size', 'responsive-brix'); $fields['mime_type'] = __('Mime Type', 'responsive-brix'); $fields['length_formatted'] = __('Run Time', 'responsive-brix'); } if (hoot_attachment_is_audio($attachment->ID)) { $fields['genre'] = __('Genre', 'responsive-brix'); $fields['year'] = __('Year', 'responsive-brix'); $fields['composer'] = __('Composer', 'responsive-brix'); $fields['track_number'] = __('Track', 'responsive-brix'); if ('display' === $context) { $fields['unsynchronised_lyric'] = __('Lyrics', 'responsive-brix'); } } return $fields; }
/** * Post <article> element attributes. * * @since 1.0.0 * @access public * @param array $attr * @return array */ function hoot_attr_post($attr) { $post = get_post(); /* Make sure we have a real post first. */ if (!empty($post)) { $attr['id'] = 'post-' . get_the_ID(); $attr['class'] = join(' ', get_post_class()); $attr['itemscope'] = 'itemscope'; if ('post' === get_post_type()) { $attr['itemtype'] = 'http://schema.org/BlogPosting'; $attr['itemprop'] = 'blogPost'; } elseif ('attachment' === get_post_type() && wp_attachment_is_image()) { $attr['itemtype'] = 'http://schema.org/ImageObject'; } elseif ('attachment' === get_post_type() && hoot_attachment_is_audio()) { $attr['itemtype'] = 'http://schema.org/AudioObject'; } elseif ('attachment' === get_post_type() && hoot_attachment_is_video()) { $attr['itemtype'] = 'http://schema.org/VideoObject'; } else { $attr['itemtype'] = 'http://schema.org/CreativeWork'; } } else { $attr['id'] = 'post-0'; $attr['class'] = join(' ', get_post_class()); } return $attr; }