Skip to content

Instantly share code, notes, and snippets.

@tomhodgins
Last active August 29, 2015 14:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomhodgins/4f390ea67e4ad412c122 to your computer and use it in GitHub Desktop.
Save tomhodgins/4f390ea67e4ad412c122 to your computer and use it in GitHub Desktop.
Adding data-personas support to WordPres
data-personas
data-default="<?php $dd = get_field_escaped($field); echo $dd; ?>"
<?php
$field = 'YourTagGoesHere';
if(get_field($field . '_mm')) {
$mm = get_field_escaped($field . '_mm'); echo 'data-persona-marketing-maggie="' . $mm . '" ';
} else {
$mm = get_field_escaped($field); echo 'data-persona-marketing-maggie="' . $mm . '" ';
}
if(get_field($field . '_tt')) {
$tt = get_field_escaped($field . '_tt'); echo 'data-persona-technical-ty="' . $tt . '" ';
} else {
$tt = get_field_escaped($field); echo 'data-persona-technical-ty="' . $tt . '" ';
}
if(get_field($field . '_cc')) {
$cc = get_field_escaped($field . '_cc'); echo 'data-persona-content-charlie="' . $cc . '" ';
} else {
$cc = get_field_escaped($field); echo 'data-persona-content-charlie="' . $cc . '" ';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment