Skip to content

Instantly share code, notes, and snippets.

@simplethemes
simplethemes / scripts.php
Created October 23, 2017 16:21
Customize the ACF color picker in your theme
// 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 October 19, 2017 17:12
SASS Margin/Padding Utilities
/*!
* Margin Offsets
*/
.mv0 {
margin-top: 0 !important;
margin-bottom: 0 !important;
}
.mh0 {
margin-left: 0 !important;
<!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>
var data = [
{
id: 1,
text: 'Adams'
},
{
id: 2,
text: 'Ashland'
},
{
/*
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 {
@simplethemes
simplethemes / functions.php
Last active November 23, 2023 12:04
CPT Rewrite
/**
* 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 April 20, 2016 21:14
Removes the YouTube dog shit from WordPress oEmbed
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 February 12, 2016 07:01
WordPress Gallery Columns - SASS / Bourbon Neat
.gallery-columns-2 {
@include row();
.gallery-item {
margin:0;
@include span-columns(6 of 12);
@include omega(2n);
text-align: center;
}
}
<?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'); ?>
@simplethemes
simplethemes / acf_toolbars_functions.php
Created October 20, 2015 21:51
Add toolbars to ACF
<?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);