Linebreaks not working in og:description
Permalink Browser Info Environment
Hi and thanks for this useful add-on.
I'm wanting to output three lines as the og:description, being year, materials and dimensions of artwork.
I'm using the following php, but the <br> are output as part of the string in Facebook (refer attached):
<code>
$desc = "Year: " . $page->getAttribute('creation_year') ;
$desc .= "<br />";
$desc .= $page->getAttribute('medium') . ' on ' . $page->getAttribute('substrate') ;
$desc .= "<br />";
$desc .= $page->getAttribute('width') . 'cm x ' . $page->getAttribute('height') . 'cm x ' . $page->getAttribute('depth') . 'cm' ;
echo $desc;
</code>
Any help solving this would be appreciated.
PK
I'm wanting to output three lines as the og:description, being year, materials and dimensions of artwork.
I'm using the following php, but the <br> are output as part of the string in Facebook (refer attached):
<code>
$desc = "Year: " . $page->getAttribute('creation_year') ;
$desc .= "<br />";
$desc .= $page->getAttribute('medium') . ' on ' . $page->getAttribute('substrate') ;
$desc .= "<br />";
$desc .= $page->getAttribute('width') . 'cm x ' . $page->getAttribute('height') . 'cm x ' . $page->getAttribute('depth') . 'cm' ;
echo $desc;
</code>
Any help solving this would be appreciated.
PK
Type: | Discussion |
---|---|
Status: | Resolved |
Please try to use "\n" instead of "<br />".