/** * Get post proccesed thumbnail * * @param int $height * Thumbnail height * @param int $width * Thumbnail width * @param boolean $crop * Crop thumbnail * @return string URL path to generated thumb * @author Panagiotis Vagenas <*****@*****.**> * @since 2.0.0 */ public function getThumbnail($height, $width, $crop) { if (!isset($this->thumbnail)) { $this->setThumbnail($this->options->getDefaultThumbnail()); } if (($height > 0 || $width > 0) && $crop) { $image = $this->resize($this->thumbnail, (int) $width, (int) $height, (bool) $crop); if (!is_wp_error($image) && !empty($image)) { return $image; } } return $this->thumbnail; }
public function formPostData(WP_Query $wpq, erpOptions $optionsObj, $ratings = array()) { erpPaths::requireOnce(erpPaths::$erpPostData); $data = array('title' => $optionsObj->getValue('title'), 'options' => $this->options, 'uniqueID' => $this->uniqueID, 'optionsObj' => $optionsObj, 'posts' => array()); while ($wpq->have_posts()) { $wpq->the_post(); $rating = isset($ratings[get_the_ID()]) ? $ratings[get_the_ID()] : null; $postData = new erpPostData($wpq->post, $optionsObj, $rating); if ($optionsObj->haveToShowExcerpt()) { $postData->setExcerpt($optionsObj->getValue('excLength'), $optionsObj->getValue('moreTxt')); } if ($optionsObj->haveToShowThumbnail()) { $postData->setThumbnail($optionsObj->getDefaultThumbnail()); } array_push($data['posts'], $postData); } wp_reset_postdata(); $this->setAdditionalViewData(array_merge($data, $this->options)); return $this; }