Adding Metaboxes
-
I’m using a plugin called Staff Directory from Cardealerpress (https://www.cardealerpress.com/products/automotive-wordpress-plugins/staff-listings-plugin/), which uses custom post types to generate a directory.
I’m trying to tweak it in order to add more meta-boxes. At the moment, there is a single line of code for the one out-of-the-box metabox as follows:
add_meta_box( 'staff_listing_title' , 'Position or Title' , array( &$this , 'meta_options' ) , 'staff_listing', 'normal' , 'high' );
I would also like to add two more metaboxes and my first attempt failed. What I tried to do is as follows:
add_meta_box( 'staff_listing_title' , 'Position or Title' , array( &$this , 'meta_options' ) , 'staff_listing', 'normal' , 'high' ); add_meta_box( 'staff_listing_phone' , 'Phone' , array( &$this , 'meta_options' ) , 'staff_listing', 'normal' , 'high' ); add_meta_box( 'staff_listing_email' , 'Email' , array( &$this , 'meta_options' ) , 'staff_listing', 'normal' , 'high' );
`
Although this gets the metaboxes appearing where I want them to, it saves the same value across metaboxes after saving, despite having entered unique values for Title, Phone and Email. E.g. It saved the value for the Email field in all three fields. This should be relatively simple, but clearly I’ve missed something.Any help would be appreciated.
Thank you
- The topic ‘Adding Metaboxes’ is closed to new replies.