Skip to content

Instantly share code, notes, and snippets.

View yellowberri-snippets's full-sized avatar

Dalton Yellowberri yellowberri-snippets

View GitHub Profile
@yellowberri-snippets
yellowberri-snippets / PHP: WP: Custom Post Type Definition
Created September 9, 2014 21:45
PHP: WP: Custom Post Type Definition
function cpt_book_init() {
$labels = array(
'name' => 'Books',
'singular_name' => 'Book',
'menu_name' => 'Books',
'name_admin_bar' => 'Book',
'add_new' => 'Add New', 'book',
'add_new_item' => 'Add New Book',
'new_item' => 'New Book',
'edit_item' => 'Edit Book',
@yellowberri-snippets
yellowberri-snippets / PHP: ACF: Barebones Image Field
Last active August 29, 2015 14:01
PHP: ACF: Barebones Image Field
$image = get_field('image');
$image['alt'] = ( empty($image['alt']) ? "\x20" : $image['alt'] );
echo "<img src='" . $image['sizes']['medium'] . "' alt='" . $image['alt'] . "'>";
@yellowberri-snippets
yellowberri-snippets / PHP: WP: Custom Taxonomy Definition
Last active August 29, 2015 14:01
PHP: WP: Custom Taxonomy Definition
// Genre Custom Taxonomy Definition
function create_book_taxonomies() {
// Add new taxonomy, make it hierarchical (like categories)
$labels = array(
'name' => _x( 'Genres', 'taxonomy general name' ),
'singular_name' => _x( 'Genre', 'taxonomy singular name' ),
'search_items' => __( 'Search Genres' ),
'all_items' => __( 'All Genres' ),
'parent_item' => __( 'Parent Genre' ),
'parent_item_colon' => __( 'Parent Genre:' ),
@yellowberri-snippets
yellowberri-snippets / SASS: Basic yb_pagination Styles
Created April 25, 2014 21:28
SASS: Basic yb_pagination Styles
.page-navigation {
ol {
position:relative;
text-align:center;
@include breakpoint(multiColumn) { margin:0 auto; }
}
li {
display: inline-block;
@yellowberri-snippets
yellowberri-snippets / PHP: ACF: Gravity Form Field Embed
Created April 7, 2014 18:25
PHP: ACF: Gravity Form Field Embed
<?php if (get_field('gravity_form')) : ?>
<div id="contact-form">
<?php
$contactForm = get_field('gravity_form');
gravity_form(
$contactForm->id,
$display_title=true,
$display_description=false,
@yellowberri-snippets
yellowberri-snippets / PHP: WP: The Default Loop
Last active August 29, 2015 13:58
PHP: WP: The Default Loop
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php endwhile; ?>
<?php endif; wp_reset_postdata(); ?>
@yellowberri-snippets
yellowberri-snippets / PHP: ACF: Repeater Field to Image Gallery or Flex Slider
Last active August 29, 2015 13:57
PHP: ACF: Repeater Field to Image Gallery or Flex Slider
@yellowberri-snippets
yellowberri-snippets / HTML: Shortcut to _images Folder
Last active August 29, 2015 13:57
HTML: _images Folder Path
/wp-content/themes/yb/library/_images/
@yellowberri-snippets
yellowberri-snippets / HTACCESS: 301 Redirect
Created February 26, 2014 19:40
HTACCESS: 301 Redirect
# Single Page
Redirect 301 /oldpage2.html http://www.yoursite.com/folder/
# Whole Site
Redirect 301 / http://newsite.com/
@yellowberri-snippets
yellowberri-snippets / SASS: Inner Column & Breakpoint Setup
Last active August 29, 2015 13:56
SASS: Inner Column & Breakpoint Setup
$mobileColumn: 400;
$narrowColumn: 700;
$multiColumn: 1000;
$mainWidth: $narrowColumn - 40;
$multiWidth: $multiColumn - 40;
$narrowWidth: 95%;
$mobileWidth: 90%;
@mixin breakpoint($point) {