Skip to content

Instantly share code, notes, and snippets.

View sbruner's full-sized avatar

Steve Bruner sbruner

View GitHub Profile
<!-- Display dynamic html markup in a textarea for easy copying and pasting -->
<!-- start object buffering -->
<?php ob_start(); ?>
<!-- create your template -->
<!-- Use the get_post_meta() function to get your data -->
<table style="width:100%">
<?php
function my_custom_init() {
remove_post_type_support( 'post', 'custom-fields' );
}
add_action( 'init', 'my_custom_init' );
<?php
// required with Piklist
piklist('field', array(
'type' => 'text'
,'field' => 'text_required'
,'label' => 'Enter some required text'
,'required' => true
));
<?php
// Demonstrates a lot of conditional fields working together
// Show this field if (guest_meal == steak) or (guest_one_meal == steak) or (guest_two_meal == steak)
piklist('field', array(
'type' => 'html'
,'field' => '_message_meal'
,'value' => __('We only serve steaks rare.', 'piklist-demo')
,'attributes' => array(
@sbruner
sbruner / gist:2e0e73d32af50db76d6218ba6946d599
Created May 12, 2016 01:35 — forked from m/gist:bab8d366d2e826ba2311
freedom zero mark pilgrim text
Movable Type has never been Free Software, as defined by the Free Software
Foundation. It has never been open source software, as defined by the Open
Source Initiative. Six Apart survived and thrived in the blogging community
because Movable Type was “free enough.”
Many people misunderstand
Free Software and the GNU General Public License. Many people equate the GPL to
the boogeyman, because it’s “viral”, and that sounds like a bad thing.
<?php
function my_add_sub_title() {
piklist('field', array(
'type' => 'text'
,'field' => 'text'
,'template' => 'field' // format the field without a label
,'attributes' => array(
'class' => 'large-text'
<?php
add_filter('piklist_taxonomies', 'demo_type_tax');
function demo_type_tax($taxonomies) {
$taxonomies[] = array(
'post_type' => 'piklist_demo'
,'name' => 'piklist_demo_type'
,'show_admin_column' => true
,'configuration' => array(
<?php
//When the user enters data in the piklist_demo_fields settings page and they press save, add another setting called option_key with the value of option_value.
add_filter('piklist_pre_update_option_piklist_demo_fields','my_update_option',10,4);
function my_update_option($settings, $setting, $new, $old) {
$settings['option_key'] = 'option_value';
return $settings;
<?php
//When the user enters data in the piklist_demo_fields settings page and they press save, add another setting called option_key with the value of option_value.
add_filter('piklist_pre_update_option','my_update_option',10,4);
function my_update_option($settings, $new, $old) {
if ($setting == 'piklist_demo_fields') {
$settings['option_key'] = 'option_value';
}