Quantcast
Channel: Joomla! Forum - community, help and support
Viewing all articles
Browse latest Browse all 1462

General Questions/New to Joomla! 5.x • Re: Call Intro or Full Article Image

$
0
0
Not sure where is the "index.php", but normally this you can do it inside the article view. So, first, make a override to com_content/article.

Then you need the follow code:

Code:

use Joomla\CMS\Factory; // this one can be already in your overrideuse Joomla\CMS\Uri\Uri;$document = Factory::getApplication()->getDocument();$images = json_decode($this->item->images);$ogImg = !empty($images->image_fulltext) ? $images->image_fulltext : $images->image_intro;if ( !empty($ogImg) ) {    $document->addCustomTag('<meta property="og:image" content="' . Uri::base() . $ogImg . '" />');}

Statistics: Posted by carlitorweb — Fri May 10, 2024 12:59 am



Viewing all articles
Browse latest Browse all 1462

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>