My client wants specific images to be shared on facebook. I have tried using a plugin to do this but i need to home page og tags to be different from the rest. Now, im not php guy so i dont really know what im doing. Here is what i have so far...
Code: Select all
<?php
$url = JURI::current();
$html = file_get_contents($url);
$doc = new DOMDocument();
@$doc->loadHTML($html);
$doc = $doc->getElementById('content');
$images = $doc->getElementsByTagName('img');
foreach ($images as $image) {
$src = $image->getAttribute('src');
echo '<meta property="og:image" content="$src\n" />';
}
?>
I have no idea.
Your advice will be greatly appreciated.