Skip to content

Instantly share code, notes, and snippets.

@heyjoecampbell
Last active August 29, 2015 14:21
Show Gist options
  • Save heyjoecampbell/d62f6ccc019c07284a88 to your computer and use it in GitHub Desktop.
Save heyjoecampbell/d62f6ccc019c07284a88 to your computer and use it in GitHub Desktop.
Use Joomla K2 ExtraFields for Meta Data (Replace Single & Double Quotes with HTML Entity)
// remove single and double quotes - place at top of item override file
<?php
$safe = array("&#39;", "&#34;");
$nonsafe = array("'", "\"");
?>
// code to generate meta data (change ExtrafieldAlias) - place after above code
<?php $doc->addCustomTag('<meta property="anything" content="'.str_replace($nonsafe, $safe, $this->item->extraFields->ExtrafieldAlias->value).'" />'); ?>
@heyjoecampbell
Copy link
Author

@kricore
Copy link

kricore commented May 14, 2015

Kudos Joe :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment