Skip to content

Instantly share code, notes, and snippets.

View retgef's full-sized avatar

Brian Fegter retgef

View GitHub Profile
@retgef
retgef / wysiwyg-meta-box.php
Created September 10, 2011 02:06
How to add a Wordpress WYSIWYG editor to a meta box.
<?php
define('WYSIWYG_META_BOX_ID', 'my-editor');
define('WYSIWYG_EDITOR_ID', 'myeditor'); //Important for CSS that this is different
define('WYSIWYG_META_KEY', 'extra-content');
add_action('admin_init', 'wysiwyg_register_meta_box');
function wysiwyg_register_meta_box(){
add_meta_box(WYSIWYG_META_BOX_ID, __('WYSIWYG Meta Box', 'wysiwyg'), 'wysiwyg_render_meta_box', 'post');
}
@retgef
retgef / wordpress_post_expirator.php
Created September 6, 2011 15:38
Wordpress Post Expirator
<?php
/*
This function assumes a custom field named 'expiration' with a human friendly date/time.
*/
function is_post_expired($post_ID = null){
if(!$post_ID) global $post;