Skip to content

Instantly share code, notes, and snippets.

@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 / Tabs Shortcode
Created August 11, 2011 07:45
Insert tabs in content with this shortcode.
[tabgroup]
[tab title="Tab 1" id="t1"]Tab 1 content[/tab]
[tab title="Tab 2" id="t2"]Tab 2 content[/tab]
[tab title="Tab 3" id="t3"]Tab 3 content[/tab]
[/tabgroup]
@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 / gist:5436978
Created April 22, 2013 17:35
Skeleton Grid (1600px)
/* Table of Contents
==================================================
#Base 960 Grid
#Tablet (Portrait)
#Mobile (Portrait)
#Mobile (Landscape)
#Clearing */
.full-width {width:960px; height:auto; overflow:hidden}
#teaser.normal {width: 960px;}
@simplethemes
simplethemes / minify-theme.php
Created January 17, 2013 05:12
minify WordPress theme styles.
/*-----------------------------------------------------------------------------------*/
// Register and Minify Core Stylesheets
/*-----------------------------------------------------------------------------------*/
function st_registerstyles() {
// minify folder name (must be in your wp root).
$minpath = '/min';
// define directories
$child_theme = str_replace(site_url().'/wp-content/themes/', '', get_bloginfo('stylesheet_directory'));
@simplethemes
simplethemes / youtube-url.php
Created November 21, 2013 23:00
Extracts YouTube video ID from various URL structures
<?php
$url = array (
'http://youtu.be/dQw4w9WgXcA',
'http://www.youtube.com/embed/dQw4w9WgXcB',
'http://www.youtube.com/watch?v=dQw4w9WgXcC',
'http://www.youtube.com/?v=dQw4w9WgXcD',
'http://www.youtube.com/v/dQw4w9WgXcE',
'http://www.youtube.com/e/dQw4w9WgXcF',
'http://www.youtube.com/user/username#p/u/11/dQw4w9WgXcG',
@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 {