File tree 2 files changed +52
-3
lines changed 2 files changed +52
-3
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,10 @@ public function getImage()
71
71
{
72
72
$ image = $ this ->getPost ()->getOgImage ();
73
73
74
+ if (!$ image ) {
75
+ $ image = $ this ->getPost ()->getFeaturedImage ();
76
+ }
77
+
74
78
if (!$ image ) {
75
79
$ image = $ this ->getPost ()->getFirstImage ();
76
80
}
Original file line number Diff line number Diff line change @@ -74,9 +74,7 @@ public function getOptionsByType($type)
74
74
'image ' => [
75
75
'@type ' => 'ImageObject ' ,
76
76
'url ' => $ this ->getImage () ?:
77
- ($ logoBlock ? $ logoBlock ->getLogoSrc () : '' ),
78
- 'width ' => 720 ,
79
- 'height ' => 720 ,
77
+ ($ logoBlock ? $ logoBlock ->getLogoSrc () : '' )
80
78
],
81
79
'publisher ' => [
82
80
'@type ' => 'Organization ' ,
@@ -172,4 +170,51 @@ protected function _toHtml()
172
170
. json_encode ($ options )
173
171
. '</script> ' ;
174
172
}
173
+
174
+
175
+ /**
176
+ * Retrieve page title
177
+ *
178
+ * @return string
179
+ */
180
+ public function getTitle ()
181
+ {
182
+ return $ this ->stripTags (
183
+ $ this ->getPost ()->getMetaTitle ()
184
+ );
185
+ }
186
+
187
+ /**
188
+ * Retrieve page short description
189
+ *
190
+ * @return string
191
+ */
192
+ public function getDescription ()
193
+ {
194
+ return $ this ->stripTags (
195
+ $ this ->getPost ()->getMetaDescription ()
196
+ );
197
+ }
198
+
199
+ /**
200
+ * Retrieve page main image
201
+ *
202
+ * @return string | null
203
+ */
204
+ public function getImage ()
205
+ {
206
+ $ image = null ;
207
+
208
+ if (!$ image ) {
209
+ $ image = $ this ->getPost ()->getFeaturedImage ();
210
+ }
211
+
212
+ if (!$ image ) {
213
+ $ image = $ this ->getPost ()->getFirstImage ();
214
+ }
215
+
216
+ if ($ image ) {
217
+ return $ this ->stripTags ($ image );
218
+ }
219
+ }
175
220
}
You can’t perform that action at this time.
0 commit comments