Skip to content

Instantly share code, notes, and snippets.

Avatar

Casey simplethemes

View GitHub Profile
@simplethemes
simplethemes / scripts.php
Created Oct 23, 2017
Customize the ACF color picker in your theme
View scripts.php
// add brand color palette to acf color picker
function kronos_acf_input_admin_footer() {
?><script type="text/javascript">
(function($) {
acf.add_filter('color_picker_args', function( args, $field ){
args.palettes = ["#000000","#CCCCCC","#EEEEEE","#FFFFFF","#b9ad33","#4c92af","#79c0a6"]
return args;
});
})(jQuery);
</script>
@simplethemes
simplethemes / utils.scss
Created Oct 19, 2017
SASS Margin/Padding Utilities
View utils.scss
/*!
* Margin Offsets
*/
.mv0 {
margin-top: 0 !important;
margin-bottom: 0 !important;
}
.mh0 {
margin-left: 0 !important;
View youtube-playlist.html
<!DOCTYPE html>
<!--[if lt IE 7 ]><html class="ie ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]><html class="ie ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]><html class="ie ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--><html lang="en"> <!--<![endif]-->
<head>
<!-- Basic Page Needs
================================================== -->
<meta charset="utf-8">
<title>Video Control Example</title>
View wisconsin_counties
var data = [
{
id: 1,
text: 'Adams'
},
{
id: 2,
text: 'Ashland'
},
{
View recent_products.php
/*
Plugin Name: Set Shop Cookie
Description: Adds a cookie for most recently viewed products
Version: 0.1
Author: Casey Lee
Author URL: https://simplethemes.com
*/
class SetWpShopCookie {
View functions.php
/**
* Register Community Custom Post Type
*/
function community_post_type() {
$labels = array(
'name' => 'Communities',
'singular_name' => 'Community',
'menu_name' => 'Communities',
'name_admin_bar' => 'Communities',
@simplethemes
simplethemes / functions.php
Created Apr 20, 2016
Removes the YouTube dog shit from WordPress oEmbed
View functions.php
function deuglify_youtube($embed) {
if (strstr($embed,'https://www.youtube.com/embed/')) {
return str_replace('?feature=oembed','?feature=oembed&autohide=1&rel=0&modestbranding=0&showinfo=0&enablejsapi=1',$embed);
} else {
return $embed;
}
}
add_filter('oembed_result', 'deuglify_youtube', 1, true);
@simplethemes
simplethemes / style.scss
Created Feb 12, 2016
WordPress Gallery Columns - SASS / Bourbon Neat
View style.scss
.gallery-columns-2 {
@include row();
.gallery-item {
margin:0;
@include span-columns(6 of 12);
@include omega(2n);
text-align: center;
}
}
View layout.php
<?php
add_action('kronos_header','site_header',1);
function site_header() { ?>
<div class="wrap header-wrap">
<div class="header-container">
<div class="site-header">
<h1 class="site-title">
<a title="<?php echo get_bloginfo( 'description' );?>" href="<?php echo esc_url(home_url('/'));?>" rel="home"><?php echo get_bloginfo( 'name' );?></a>
</h1>
<?php do_action('kronos_show_menu','primary'); ?>
View acf_toolbars_functions.php
<?php
if (! function_exists('st_acf_toolbars')) {
function st_acf_toolbars() {
// Full
$toolbars['Full'] = array();
$toolbars['Full'][1] = apply_filters('mce_buttons', array('code','bold', 'italic', 'strikethrough', 'bullist', 'numlist', 'blockquote', 'justifyleft', 'justifycenter', 'justifyright', 'link', 'unlink', 'wp_more', 'spellchecker', 'fullscreen', 'wp_adv' ), $editor_id);
$toolbars['Full'][2] = apply_filters('mce_buttons_2', array( 'formatselect', 'underline', 'justifyfull', 'forecolor', 'pastetext', 'pasteword', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo'), $editor_id);
$toolbars['Full'][3] = apply_filters('mce_buttons_3', array(), $editor_id);
You can’t perform that action at this time.