diff --git a/sources/sf2/Generic/WordpressBundle/Repository/Post.php b/sources/sf2/Generic/WordpressBundle/Repository/Post.php index badc8af..158ee61 100644 --- a/sources/sf2/Generic/WordpressBundle/Repository/Post.php +++ b/sources/sf2/Generic/WordpressBundle/Repository/Post.php @@ -8,6 +8,7 @@ class Post private $metas = array(); private $type = 'post'; private $tags; + private $linkImg = ''; public function getWPPost() { @@ -37,6 +38,10 @@ public function setMeta($key, $value) return $this; } + public function getLinkImg(){ + return $this->linkImg; + } + public function __construct($post = null) { $this->wp_post = $post; @@ -47,7 +52,12 @@ public function __construct($post = null) $this->type = $this->wp_post->post_type; } if ($this->wp_post->ID!=null) { - $this->metas = get_metadata('post', $this->wp_post->ID); + $this->metas = get_metadata('post', $this->wp_post->ID); + $idAttachment = $this->getMeta("_thumbnail_id"); + if(!empty($idAttachment)){ + $link = wp_get_attachment_image_src($idAttachment[0]); + $this->linkImg = $link[0]; + } } }