Skip to content

Instantly share code, notes, and snippets.

View jrstaatsiii's full-sized avatar

Rich Staats jrstaatsiii

View GitHub Profile
@jrstaatsiii
jrstaatsiii / fields.php
Last active December 14, 2019 16:19
Default Fields for SSM Projects
<?php
use StoutLogic\AcfBuilder\FieldsBuilder;
/**
* 01. Options
* a. Admin Options
* b. Background Options
@jrstaatsiii
jrstaatsiii / hierarchal-posts.php
Created April 11, 2019 13:39
make post's hierarchal
add_filter('register_post_type_args', 'hierarchal_posts', 10, 2);
function hierarchal_posts($args, $post_type){
if ($post_type == 'post'){
$args['hierarchal'] = true;
}
return $args;
}
@jrstaatsiii
jrstaatsiii / products.json
Created November 15, 2018 00:58
Products Endpoint
{
"Product": [
{
"Description": "Cutting-edge envelope sealing technology for commercial, residential, and multi-family applications.",
"PDFResources": [
"AeroBarrier Durability Testing",
"AeroBarrier Full Line Brochure",
"AeroBarrier Overview and FAQ Flyer",
"AeroBarrier X1 Sealant Datasheet and SDS"
],
@jrstaatsiii
jrstaatsiii / glossary.json
Last active November 21, 2018 15:33
Endpoints
{
"Glossary": [{
"Term": "", // get_the_title();
"Definition": "", // get_the_content();
"Active": "", // get_field('is_active');
"Legacy_ID": "", // get_field('legacy_id');
"ID" : "" // get_the_ID();
]}
}
<?php
// only no index all events archived
add_action('wp_head', 'no_index_event_archives', 10, 3);
function no_index_event_archives() {
if ( ! is_post_type_archive('tribe_events') )
return;
@jrstaatsiii
jrstaatsiii / schema.php
Last active November 18, 2018 01:33
Schema
<?php
function schema_builder( $context ) {
$html = '<script type= "application/ld+json">';
$html .= '{';
$html .= '"@context": "http://schema.org",';
$html .= '"@type": "Organization",';
$html .= '"@name": "' . get_blog_info('name') . ',";
$html .= '"@url": "' . get_blog_info('url') . ',";
if ( $has_brand_logo ) {
@jrstaatsiii
jrstaatsiii / svgnav.html
Last active July 6, 2018 00:58
SVG Image Navigation
<nav class="primary-navigation">
<ul class="logo-menu">
<li class="menu-item">
<a href="#">
<span class="hide-on-medium">Brand One</span>
<img class="show-on-medium" src="/path/to/img.svg" aria-label="Brand One Logo" alt="Brand One Logo" />
</a>
</li>
<li class="menu-item">
<a href="#">
<?php
// Bail if section is set to inactive
if ( get_sub_field('status') == 0 )
return;
global $tpl_args;
$s_classes = array('faqs-template');
<?php
// Conditional Itinerary Builder Template
$form_page = get_option('form_page');
$suggestions_page = get_option('suggestions_page');
$results_page = get_option('results_page);
if ( is_page( $form_page ) ) {
get_template_part('/templates/form-page');
@jrstaatsiii
jrstaatsiii / carbonfields.php
Created December 19, 2017 02:58
Quick Example of how we might organize our Carbon Fields setup
<?php
add_action( 'init', 'ssm_remove_post_type_support' );
function ssm_remove_post_type_support() {
remove_post_type_support( 'page', 'editor' );
}
add_action( 'after_setup_theme', 'crb_load' );