public
Created

Ad-hoc Plugin Example for Atlanta WordPress Developer Meetup - 2011-12-12

  • Download Gist
jills_properties.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
<?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();

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.