Skip to content

Instantly share code, notes, and snippets.

@jrstaatsiii
Last active January 7, 2017 04:58
Show Gist options
  • Save jrstaatsiii/ee6c2bd4d9e6abf218b450755dfd0b8f to your computer and use it in GitHub Desktop.
Save jrstaatsiii/ee6c2bd4d9e6abf218b450755dfd0b8f to your computer and use it in GitHub Desktop.
SSM Hello bar with ACF / Foundation6
<?php
add_action ('genesis_before', 'ssm_do_hellobar');
/**
* Create Hellobar
*
*/
function ssm_do_hellobar() {
if ( get_field('show_global_message') == 'Yes' && get_field('global_message', 'options') != NULL ) {
echo '<div class="callout primary show-for-medium" data-closable>';
the_field('global_message', 'options');
echo '<button class="close-button" aria-label="Dismiss alert" type="button" data-close><span aria-hidden="true">&times;</span></button>';
echo '</div>';
} elseif ( get_field('show_global_message') == 'Override' && get_field('global_message') != NULL ) {
echo '<div class="callout primary show-for-medium" data-closable>';
the_field('global_message');
echo '<button class="close-button" aria-label="Dismiss alert" type="button" data-close><span aria-hidden="true">&times;</span></button>';
echo '</div>';
}
}
{
"key": "group_5642614b96b29",
"title": "Hello Bar",
"fields": [
{
"key": "field_564261b79e4e6",
"label": "Global Message",
"name": "global_message",
"type": "wysiwyg",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"tabs": "all",
"toolbar": "full",
"media_upload": 0
}
],
"location": [
[
{
"param": "options_page",
"operator": "==",
"value": "acf-options-brand-options"
}
]
],
"menu_order": 10,
"position": "normal",
"style": "default",
"label_placement": "top",
"instruction_placement": "label",
"hide_on_screen": "",
"active": 1,
"description": "",
"modified": 1453914334
}
{
"key": "group_56672fb313738",
"title": "Hello Bar",
"fields": [
{
"key": "field_56672fcb9e78a",
"label": "Show global message?",
"name": "show_global_message",
"type": "radio",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"choices": {
"Yes": "Yes",
"Override": "Override",
"No": "No"
},
"other_choice": 0,
"save_other_choice": 0,
"default_value": "Yes",
"layout": "horizontal"
},
{
"key": "field_56672ff27bf12",
"label": "Message",
"name": "global_message",
"type": "wysiwyg",
"instructions": "",
"required": 0,
"conditional_logic": [
[
{
"field": "field_56672fcb9e78a",
"operator": "==",
"value": "Override"
}
]
],
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"tabs": "all",
"toolbar": "full",
"media_upload": 1
}
],
"location": [
[
{
"param": "post_type",
"operator": "==",
"value": "post"
}
],
[
{
"param": "post_type",
"operator": "==",
"value": "page"
}
]
],
"menu_order": 20,
"position": "normal",
"style": "default",
"label_placement": "top",
"instruction_placement": "label",
"hide_on_screen": "",
"active": 1,
"description": "",
"modified": 1449603377
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment