Skip to content

Instantly share code, notes, and snippets.

View jrstaatsiii's full-sized avatar

Rich Staats jrstaatsiii

View GitHub Profile
@jrstaatsiii
jrstaatsiii / do-navigation.php
Created August 23, 2017 17:34
ssm_do_navigation
<?php
function ssm_do_navigation( $location = 'header' ) {
$menu = '';
$depth = '';
$items_wrap = '';
if ( $location == 'header' ) {
$default_menu = get_field('default_primary_navigation', 'options');
@jrstaatsiii
jrstaatsiii / portfolio-grid.php
Last active September 6, 2017 19:25
Portfolio Grid
<?php
$args = array(
'post_type' => 'case-study',
'post_status' => 'publish',
'facetwp' => true,
'ssm' => true
);
$query = new WP_Query( $args );
@jrstaatsiii
jrstaatsiii / pricing-plan-template.php
Created May 9, 2017 21:14
Template Tag for SSM Pricing Tables
<?php
function pricing_plan_template( $plan, $display = 'full', $pricing_table_id ) {
$features = get_field('features', $pricing_table_id); // list or curated
if ( $features == 'list') {
$available_features = get_field('standard_feature_list', $pricing_table_id);
$standard_features = $plan['standard_features'];
{
"key": "group_5888f0f081f23",
"title": "Page Builder",
"fields": [
{
"key": "field_5888f0f5a2760",
"label": "Content Blocks",
"name": "content_blocks",
"type": "flexible_content",
"instructions": "<strong>Content Blocks<\/strong> are horizontal rows of content containing one or more columns.",
@jrstaatsiii
jrstaatsiii / function-hellobar.php
Last active January 7, 2017 04:58
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 ) {
@jrstaatsiii
jrstaatsiii / flexcontent.php
Last active July 10, 2016 21:42
Example Flexible Content Field Group
<?php
if( function_exists('acf_add_local_field_group') ):
acf_add_local_field_group(array (
'key' => 'group_5436e219da3a2',
'title' => 'Layout Builder',
'fields' => array (
array (
'key' => 'field_5436e27cb585e',
'label' => 'Content Blocks',
<script>
gform.addFilter( 'gform_datepicker_options_pre_init', function( optionsObj, formId, fieldId ) {
if ( formId == 2 && fieldId == 5 ) {
optionsObj.dateFormat = 'mm-dd-yy';
}
return optionsObj;
});
</script>
@jrstaatsiii
jrstaatsiii / content-block-instance.php
Created December 28, 2015 18:37
Get First Instance of Content Block
/*
* Returns the first instance of a given layout option
* @param - $id - the id of the post you are trying to target: '' by default
* @param - $fc_field - the name of the ACF flexible field: 'content_blocks' as the default
* @param - $fc_layout - the name of the flexible content layout: 'visual_editor' as the default
* @return - mixed
* @todo - test different types of returned content. at the moment, I am only using this for returning a string
*/
function get_first_instance_of_content_block( $id = '', $fc_field = 'content_blocks', $fc_layout = 'visual_editor' ) {
@jrstaatsiii
jrstaatsiii / acf-content-blocks.php
Last active October 3, 2015 21:52
Attempting to insert options into a content block, but only if that content block was selected.
<?php
/**
* Load default choices from options page into content blocks
*/
function acf_load_style_default_choices( $field ) {
// reset choices
$field['choices'] = array();
@jrstaatsiii
jrstaatsiii / product-search-block
Created July 3, 2014 14:46
Product Search Block
<section id="product-search" class="products-search products content-block entry">
<?php if ( get_sub_field('ssm_headline') ) { ?>
<header class="content-block-header">
<?php if ( get_sub_field('ssm_intro_copy') ) { ?>
<div class="intro">