Skip to content

Instantly share code, notes, and snippets.

View tessak22's full-sized avatar
🚀
Cultivating Developer Community @Snapchat

Tessa Kriesel tessak22

🚀
Cultivating Developer Community @Snapchat
View GitHub Profile
@tessak22
tessak22 / page.php
Created October 5, 2018 17:38
ACF Page Builder - Add to template file
<?php //each page builder has its own section
get_template_part('inc', 'page-builder');
?>
@tessak22
tessak22 / template-file.php
Created December 11, 2017 16:36
Advanced Custom Fields IF Statements
//Used in Template
<?php if(get_field('banner_image')): ?>
<div class="banner-image"><img class="img-responsive" src="<?php the_field('banner_image'); ?>"></div>
<?php endif; ?>
//Used in custom post types
<?php
@tessak22
tessak22 / upcoming-events.php
Created December 10, 2017 18:01
Templating for Custom Post Type sorting by ACF Date Field
<?php
$today = current_time('Ymd');
$args = array(
'post_type' => 'events',
'posts_per_page' => '20',
'meta_key' => 'speaking_date',
'order' => 'ASC',
'orderby' => 'meta_value',
'meta_query' => array(
array(
@tessak22
tessak22 / functions.php
Created December 10, 2017 17:46
Create Custom Post Type in WordPress
add_action('init', 'tessak22_register_custom_post_types', 0);
function tessak22_register_custom_post_types()
{
$arr_custom_post_type_options = array(
/*
array(
'label' => 'lowercase_name' // ** 20 char max, no spaces or caps
'singlar' => 'Human-Readable Item' // singular name
'plural' => 'Human-Readable Items' // plural name
'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'page-attributes', 'post-formats')