Fix error when blog post has no featured image
This commit is contained in:
parent
36ba266587
commit
d3a6cf34bc
2 changed files with 3 additions and 3 deletions
|
@ -41,7 +41,7 @@ if ('en' !== \Locale::getPrimaryLanguage($_SESSION['user']->getLocale())) {
|
||||||
\IntlDateFormatter::MEDIUM,
|
\IntlDateFormatter::MEDIUM,
|
||||||
\IntlDateFormatter::NONE
|
\IntlDateFormatter::NONE
|
||||||
);
|
);
|
||||||
$mediaHTML = isset($post->featured_media) ? Blog::getMediaHTML($post->featured_media) : '';
|
$mediaHTML = isset($post->featured_media) && 0 !== $post->featured_media ? Blog::getMediaHTML($post->featured_media) : '';
|
||||||
$categoriesHTML = Blog::getCategoriesHTML($post->categories);
|
$categoriesHTML = Blog::getCategoriesHTML($post->categories);
|
||||||
$postLink = Page::PAGE_POST . '&slug=' . $post->slug;
|
$postLink = Page::PAGE_POST . '&slug=' . $post->slug;
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -11,8 +11,8 @@ namespace wishthis;
|
||||||
$postSlug = $_GET['slug'];
|
$postSlug = $_GET['slug'];
|
||||||
$posts = Blog::getPreviousCurrentNextPostBySlug($postSlug);
|
$posts = Blog::getPreviousCurrentNextPostBySlug($postSlug);
|
||||||
$post = $posts['current'];
|
$post = $posts['current'];
|
||||||
$postMediaHTML = isset($post->featured_media) ? Blog::getMediaHTML($post->featured_media) : '';
|
$postMediaHTML = isset($post->featured_media) && 0 !== $post->featured_media ? Blog::getMediaHTML($post->featured_media) : '';
|
||||||
$postMedia = isset($post->featured_media) ? Blog::getMedia($post->featured_media) : new \stdClss();
|
$postMedia = isset($post->featured_media) && 0 !== $post->featured_media ? Blog::getMedia($post->featured_media) : new \stdClass();
|
||||||
|
|
||||||
$page = new Page(__FILE__, $post->title->rendered);
|
$page = new Page(__FILE__, $post->title->rendered);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue