<?php /* Plugin Name: Fake Plugin (Meta Boxes) Plugin URI: http://baylorrae.com Description: What a cool thing Author: Baylor Rae' Version: Beta Author URI: http://baylorrae.com/ */ include 'WP-Elements.class.php'; // ============ // = Form Box = // ============ $poem = new metaBox(array('isFormBox' => true, 'id' => 'whatDoYaThink', 'title' => 'What Do Ya Think')); $poem->addInput(array('id' => 'tellme', 'label' => 'Tell Me')); $poem->addTextarea(array('id' => 'more', 'label' => 'Give Me More')); $poem->addEditor(array('id' => 'evenmore', 'label' => "Don't Hold Back On Me")); // A single checkbox $poem->addCheckbox(array('id' => 'isSpecial', 'label' => 'Is Special?', 'title' => 'Status')); // Multiple checkboxes // checked always defaults to false $poem->addCheckbox(array('id' => 'repairs', 'label' => 'Repairs Include', 'options' => array('Engine' => array('id' => 'engine', 'checked' => true), 'Tires' => array('id' => 'tires'), 'Brake Lights' => array('id' => 'brakelights', 'checked' => true)))); $poem->addRadiobuttons(array('id' => 'gender', 'label' => 'Gender', 'value' => 'male', 'options' => array('Male' => 'male', 'Female' => 'female'))); $poem->addDropdown(array('id' => 'type', 'label' => 'Type', 'options' => array('Car' => 'car', 'Truck' => 'truck', 'Motorcycle' => 'motorcycle'))); // =============== // = Regular Box = // =============== $box2 = new metaBox(array('id' => 'box2', 'title' => 'This is my second box', 'context' => 'side')); $box2->html('<p>Please click on my <a href="#">link</a></p>'); $box2->paragraph('Please tell me something');
<?php /* Plugin Name: Add a super hero to your post Plugin URI: http://baylorrae.com Description: Adds a super hero to your post and lets you rate their awesomeness Author: Baylor Rae' Version: Beta Author URI: http://baylorrae.com/ */ // =============== // = Add The Box = // =============== include 'WP-Elements.class.php'; $box = new metaBox(array('isFormBox' => true, 'type' => 'post', 'id' => 'superHero', 'title' => 'Add a Super Hero')); $box->addInput(array('id' => 'nickname', 'label' => 'Nickname', 'value' => get_post_meta($_GET['post'], 'nickname', true), 'size' => 'large')); $box->addDropdown(array('id' => 'awesomeness', 'label' => 'Awesomeness', 'value' => get_post_meta($_GET['post'], 'awesomeness', true), 'options' => array('Ultra Awesome' => 'ultra', 'Super Awesome' => 'super', 'Not So Awesome' => 'notSo', 'Kinda Dull Awesome' => 'kindaDull', 'Super Duper Mega Awesome!' => 'superDuperMega'))); $box->addRadiobuttons(array('id' => 'gender', 'label' => 'Gender', 'value' => get_post_meta($_GET['post'], 'gender', true), 'options' => array('Male' => 'male', 'Female' => 'female')));