Created
December 13, 2011 03:20
-
-
Save mikeschinkel/1470371 to your computer and use it in GitHub Desktop.
Ad-hoc Plugin Example for Atlanta WordPress Developer Meetup - 2011-12-12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Plugin Name: Jill's Properties | |
* Description: Ad-hoc Plugin Example for Atlanta WordPress Developer Meetup - 2011-12-12 | |
* Author: Mike Schinkel | |
* Author URI: http://about.me/mikeschinkel | |
* Version: 0.1 | |
*/ | |
class Jills_Properties { | |
static function on_load() { | |
add_action( 'init', array( __CLASS__, 'init' ) ); | |
add_filter( 'the_content', array( __CLASS__, 'the_content' ) ); | |
} | |
function the_content( $content ) { | |
if ( 'jills_property' == get_post_type() ) { | |
return $content . '<p>Call Jill NOW!!! 555-1212</p>'; | |
} | |
return $content; | |
} | |
function init() { | |
register_post_type( 'jills_property', array( | |
'labels' => array( | |
'name' => _x( 'Properties', 'jills_properties' ), | |
'singular_name' => _x( 'Property', 'jills_properties' ), | |
'add_new' => _x( 'Add New', 'jills_properties' ), | |
'add_new_item' => _x( 'Add New Property', 'jills_properties' ), | |
'all_items' => _x( 'Properties', 'jills_properties' ), | |
'edit_item' => _x( 'Edit Property', 'jills_properties' ), | |
'new_item' => _x( 'New Property', 'jills_properties' ), | |
'view_item' => _x( 'View Property', 'jills_properties' ), | |
'search_items' => _x( 'Search Properties', 'jills_properties' ), | |
'not_found' => _x( 'No Properties found', 'jills_properties' ), | |
'not_found_in_trash' => _x( 'No Properties found in Trash', 'jills_properties' ), | |
'parent_item_colon' => _x( 'Parent Property', 'jills_properties' ), | |
'menu_name' => _x( 'Properties', 'jills_properties' ), | |
), | |
'public' => true, | |
'show_ui' => true, | |
'rewrite' => array( 'slug' => 'properties' ), | |
'supports' => array( | |
'title', | |
'editor', | |
'thumbnail', | |
), | |
)); | |
} | |
} | |
Jills_Properties::on_load(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment