Skip to content

Instantly share code, notes, and snippets.

View turtlepod's full-sized avatar
🎧
Working from home

David Chandra Purnama turtlepod

🎧
Working from home
View GitHub Profile
@turtlepod
turtlepod / gtoc.php
Created July 28, 2012 09:46
Genbu Table Of Content Shortcode
<?php
/*
* Genbu Table Of Content Shortcode
* use [gtoc] to generate shortcode
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* Based on (credit) :
* WP TOC by Brendon Boshell http://infinity-infinity.com/
@turtlepod
turtlepod / unplugged-plugin.php
Created November 29, 2012 17:37 — forked from rachelbaker/unplugged-plugin.php
Load a different WordPress theme for mobile visitors
<?php
/*
Plugin Name: Unplugged Mobile Theme
Plugin URI: http://www.rachelbaker.me
Description: A plugin and theme for WordPress that automatically reformats your blog's content for optimized viewing on Apple's <a href="http://www.apple.com/unplugged/">unplugged</a> and <a href="http://www.apple.com/ipodtouch/">iPod touch</a>.
Author: Rachel Baker
Version: 0.1
Author URI: http://www.rachelbaker.me
# Special thanks to Imthiaz Rafiq and the wp-pda Plugin (http://imthi.com/wp-pda/) which this plugin is derived from.
@turtlepod
turtlepod / gist:5114385
Created March 8, 2013 05:25
Better Hybrid Core Theme Settings, with column options. CSS won't work. cause the div's change. this just following HTML in post edit screen
<?php
/**
* Handles the display and functionality of the theme settings page. This provides the needed hooks and
* meta box calls for developers to create any number of theme settings needed. This file is only loaded if
* the theme supports the 'hybrid-core-theme-settings' feature.
*
* Provides the ability for developers to add custom meta boxes to the theme settings page by using the
* add_meta_box() function. Developers should register their meta boxes on the 'add_meta_boxes' hook
* and register the meta box for 'appearance_page_theme-settings'. To validate/sanitize data from
* custom settings, devs should use the 'sanitize_option_{$prefix}_theme_settings' filter hook.
@turtlepod
turtlepod / gist:5203512
Last active February 17, 2020 16:56
Settings Class with Metabox
<?php
/* Prevent loading this file directly and/or if the class is already defined */
if ( ! defined( 'ABSPATH' ) || class_exists( 'MYFX_Settings_Class' ) )
return;
/**
* Settings with Meta Boxes
* Helper class to easily create settings page for plugin or theme with Meta Box API.
*
@turtlepod
turtlepod / gist:5250802
Created March 27, 2013 01:21
my debug mu-plugin. only use this on localhost.
<?php
/**
* Plugin Name: Debug-ing
* Plugin URI: http://shellcreeper.com/
* Description: just for debug on localhost.
* Version: 0.1.0
* Author: David Chandra Purnama
* Author URI: http://shellcreeper.com/
*/
@turtlepod
turtlepod / gist:5343584
Last active December 15, 2015 23:50
Debug: Metabox order and hidden metabox
<?php
/* data to display */
function capsule_print_data(){
global $current_user;
# Metabox Order
$meta_box_order = get_user_meta(
wp_get_current_user()->ID
,sprintf( 'meta-box-order_%s', 'post' )
,true
@turtlepod
turtlepod / gist:5343672
Last active December 15, 2015 23:58
Example to filter editor style json style_formats
<?php
function capsule_print_data2(){
/* style dropdown */
$settings = array();
$style_formats = array(
array(
'title' => 'Code',
'inline' => 'code',
),
@turtlepod
turtlepod / gist:5378353
Created April 13, 2013 13:13
Shell Editor CSS custom markup. Need to remove this from shell somehow....
/**
* Shell Content Editor CSS
* =========================
*/
/* Note */
.note {
padding: 6px 9px;
background: #eee;
border: 1px solid #ccc;
@turtlepod
turtlepod / gist:5921837
Created July 3, 2013 19:15
Hybrid Base functions.php with link to Docs
<?php
/**
* The functions file is used to initialize everything in the theme. It controls how the theme is loaded and
* sets up the supported features, default actions, and default filters. If making customizations, users
* should create a child theme and make changes to its functions.php file (not this one). Friends don't let
* friends modify parent theme files. ;)
*
* Child themes should do their setup on the 'after_setup_theme' hook with a priority of 11 if they want to
* override parent theme features. Use a priority of 9 if wanting to run before the parent theme.
*
@turtlepod
turtlepod / meta-box-class.php
Last active December 27, 2015 15:39
Simple Meta Box Helper Class
<?php
/* Prevent loading this file directly and/or if the class is already defined */
if ( ! defined( 'ABSPATH' ) || class_exists( 'SC_Plugin_Meta_Box_Class' ) )
return;
/**
* Shellcreeper Meta Boxes Class
* Helper class to easily create meta boxes in post edit screen with Meta Box API.
* Rename this class name if you use it in your plugin/theme.