Created
December 3, 2013 14:46
-
-
Save clare485/7770321 to your computer and use it in GitHub Desktop.
custom meta boxes
This file contains hidden or 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
http://wordpress.org/plugins/meta-box/ | |
https://github.com/humanmade/Custom-Meta-Boxes |
This file contains hidden or 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
require_once 'inc/custom_meta_boxes/custom-meta-boxes.php'; | |
require_once 'inc/custom_meta_boxes/page_meta_box.php'; |
This file contains hidden or 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 | |
/* | |
* add meta boxes | |
*/ | |
add_action( 'admin_init', 'rw_register_meta_boxes' ); | |
function rw_register_meta_boxes() | |
{ | |
if ( !class_exists( 'RW_Meta_Box' ) ) | |
return; | |
$prefix = 'leven_'; | |
$meta_boxes = array(); | |
// 1st meta box | |
$meta_boxes[] = array( | |
'title' => 'Right hand sidebar', | |
'pages' => array( 'page' ), | |
'fields' => array( | |
array( | |
'name' => 'Right hand sidebar', | |
'desc' => '', | |
'id' => $prefix . 'right_hand_sidebar', | |
'type' => 'wysiwyg', | |
), | |
) | |
); | |
// testimonials | |
$meta_boxes[] = array( | |
'title' => 'Add property link', | |
'pages' => array( 'testimonial' ), | |
'fields' => array( | |
array( | |
'name' => 'Add name of property that this testimonial relates to eg "Helen stayed at Citadene Prestige in Kensington" Add link using link icon in wysiwyg box', | |
'id' => $prefix . 'property_name', | |
'type' => 'wysiwyg', | |
), | |
) | |
); | |
foreach ( $meta_boxes as $meta_box ) { | |
new RW_Meta_Box( $meta_box ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment