Skip to content

Instantly share code, notes, and snippets.

View drrobotnik's full-sized avatar

Brandon drrobotnik

  • ThermoFisher Scientific
  • San Diego
View GitHub Profile
@drrobotnik
drrobotnik / widget.html
Created June 11, 2014 18:58
open table html
<div class="otw-minimal-light-style open-table-widget" style="/* max-width:250px; */"><h3 class="otw-widget-title ">Single Restaurant Reservation</h3>
<div class="otw-minimal-light">
<div class="otw-widget-form-wrap">
<form method="get" class="otw-widget-form" action="http://www.opentable.com/restaurant-search.aspx" target="_blank">
<div class="otw-wrapper">
<div class="otw-date-wrap otw-input-wrap">
@drrobotnik
drrobotnik / page.php
Created June 17, 2014 23:26
dynamic condition
function cv_acf_optional_template_parts( $slug = 'layouts/acf/', $names = array(''), $label = 'optional_layouts', $post_id = null ) {
while( has_sub_field( $label, $post_id ) ) {
foreach ( $names as $field ) {
if ( $field == get_row_layout() ){
$template = str_replace('_', '-', $field);
get_template_part( 'layouts/acf/' . $template );
}
@drrobotnik
drrobotnik / .gitignore
Created June 18, 2014 16:08
global ignore
*.sublime-workspace
wp-config.local.php
.sass-cache/
.DS_Store
cache/
*~
.DS_Store
if ( false === ( $result = get_transient( 'sdrock_jobs' ) ) ) {
// It wasn't there, so regenerate the data and save the transient
$result = wp_remote_get( 'http://www.sdrock.com/mobileapp/ajax/job_list_items/?organization=academy' );
$code = wp_remote_retrieve_response_code( $result );
$body = wp_remote_retrieve_body( $result );
if( $code != 200 ){
return false;
}else{
@drrobotnik
drrobotnik / README.md
Created June 27, 2014 20:15
functions.php

###Concept ACF Flexible content field is very handy for creating many optional layouts. Sometimes we want to restrict an optional layout to be used only one time, and sometimes in a specific location. This helper function allows you to control the flexibility, but enforce the structure cleanly as if you were using WP's get_template_part. See page.php for examples.

###File Structure Put the layout files inside of /themes/themename/layouts/acf/layout-file.php

###Naming optional field name: grid_slider, will look for file: grid-slider.php

<?php
/**
* Cleaner walker for wp_nav_menu()
*
* Walker_Nav_Menu (WordPress default) example output:
* <li id="menu-item-8" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-8"><a href="/">Home</a></li>
* <li id="menu-item-9" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-9"><a href="/sample-page/">Sample Page</a></l
*
* Roots_Nav_Walker example output:
* <li class="menu-home"><a href="/">Home</a></li>
@drrobotnik
drrobotnik / html
Created July 10, 2014 00:02
responsive ratio
jQuery(document).ready(function($) {
$(window).on('load resize orientationchange',aspectRatioRespond);
aspectRatioRespond();
});
function aspectRatioRespond(){
mobileMax = 480;
elements = jQuery('[data-ratio]');
elements.each(function(){
container = jQuery(this);
<?php get_header(); ?>
<div class="sub-section"><?php
get_template_part( 'layout', 'gallery' );
get_template_part( 'layout', 'sub-menu' );
?></div>
<div id="primary" class="content-area site-archives">
<div id="content" class="site-content" role="main">
<h3>Categories</h3>
<ul class="arc-list clearfix" id="categories">
@drrobotnik
drrobotnik / page-archive.php
Created July 15, 2014 18:40
annual archive
<?php get_header(); ?>
<div class="sub-section"><?php
get_template_part( 'layout', 'gallery' );
get_template_part( 'layout', 'sub-menu' );
?></div>
<div id="primary" class="content-area site-archives">
<div id="content" class="site-content" role="main">
<?php
$output = '';
<?php /**
* On the fly image cropping based on WP 3.5 image editor
*
* @since 1.0
*
* @param int $id
* @param int $width
* @param int $height
* @param boolean $crop
* @return string