/** * Displays preview * @author jtsternberg * @since 5.3.2 * * @param $args * @param $field * * @return mixed */ function cmb_update_title_description($args, $field) { if ('twitter_featured_size' === $field->id()) { $args['desc'] = Thumbs::get_post_thumbnail_size($field->object_id); } if ('preview_title' === $field->id()) { $args['desc'] = Preview::show_preview($field->object_id); } return $args; }
/** * @return array|bool */ public function image() { $cardImage = get_post_meta($this->post_ID, 'cardImage', true); //fallback $image = $this->opts['twitterImage']; if ($this->post_ID && empty($cardImage) && has_post_thumbnail($this->post_ID)) { $size = Thumbs::thumbnail_sizes(); $image_attributes = wp_get_attachment_image_src(get_post_thumbnail_id($this->post_ID), $size); $image = reset($image_attributes); } elseif (!empty($cardImage)) { $image = wp_get_attachment_url((int) $cardImage); } elseif ('attachment' === get_post_type()) { $image = wp_get_attachment_url($this->post_ID); } elseif (empty($this->post_ID)) { $image = $this->opts['twitterImage']; } return array('image' => apply_filters('jm_tc_image_source', $image)); }