Your theme uses metaboxes that are specific to certain page templates, and are also hidden as such in other page templates (done by jquery), that is why your new page template won’t work as expected.
Here is how to solve your problem.:
Call your testimonials template “template.testimonials.php”. As you have already copied the code from the storage template, and change the template name accordingly, open the template and change all instances of ‘storage ‘ to ‘testimonials’. This will prevent later issues with the metaboxes.
In your “enable.php” on lines 40 to 75 you have the following code
$meta_boxes[] = array(
'id' => 'page-storage',
'title' => 'Storage Content',
'pages' => array('page'),
'context' => 'normal',
'priority' => 'high',
'show_names' => 'true',
'fields' => array(
array(
'name' => 'Box #1 Heading',
'desc' => 'Please input the heading of Box#1 here',
'id' => $prefix . 'storage-box-one-heading',
'type' => 'text_medium'
),
array(
'name' => 'Box #1 Content',
'desc' => 'Please input the content of Box#1 here',
'id' => $prefix . 'storage-box-one-content',
'type' => 'wysiwyg',
'options' => array( 'textarea_rows' => 6, )
),
array(
'name' => 'Box #2 Heading',
'desc' => 'Please input the heading of Box#2 here',
'id' => $prefix . 'storage-box-two-heading',
'type' => 'text_medium'
),
array(
'name' => 'Box #2 Content',
'desc' => 'Please input the content of Box#2 here',
'id' => $prefix . 'storage-box-two-content',
'type' => 'wysiwyg',
'options' => array( 'textarea_rows' => 6, )
)
)
);
You need to copy that code, paste it directly below line 75 and change all instances of storage to testimonials like this
$meta_boxes[] = array(
'id' => 'page-testimonials',
'title' => 'Testimonials Content',
'pages' => array('page'),
'context' => 'normal',
'priority' => 'high',
'show_names' => 'true',
'fields' => array(
array(
'name' => 'Box #1 Heading',
'desc' => 'Please input the heading of Box#1 here',
'id' => $prefix . 'testimonials-box-one-heading',
'type' => 'text_medium'
),
array(
'name' => 'Box #1 Content',
'desc' => 'Please input the content of Box#1 here',
'id' => $prefix . 'testimonials-box-one-content',
'type' => 'wysiwyg',
'options' => array( 'textarea_rows' => 6, )
),
array(
'name' => 'Box #2 Heading',
'desc' => 'Please input the heading of Box#2 here',
'id' => $prefix . 'testimonials-box-two-heading',
'type' => 'text_medium'
),
array(
'name' => 'Box #2 Content',
'desc' => 'Please input the content of Box#2 here',
'id' => $prefix . 'testimonials-box-two-content',
'type' => 'wysiwyg',
'options' => array( 'textarea_rows' => 6, )
)
)
);
You now have to add the functionality to your js file in order to display the correct metaboxes and also hide them on the correct page template.
Now open your “script-metabox-template-toggle.js” .
Add the following line jQuery('#page-testimonials').hide();
to
function hide_all_custom_metaboxes() {
jQuery('#page-facilities').hide();
jQuery('#page-services').hide();
jQuery('#page-storage').hide();
}
and then the following code
case 'testimonials':
jQuery('#postdivrich').css("display","none");
show_custom_metabox("page-testimonials");
break;
just below
case 'storage':
jQuery('#postdivrich').css("display","none");
show_custom_metabox("page-storage");
break;
So your completed code should be
jQuery(document).ready(function() {
// in this functions hide all the custom metaboxes that are used
function hide_all_custom_metaboxes() {
jQuery('#page-facilities').hide();
jQuery('#page-services').hide();
jQuery('#page-storage').hide();
jQuery('#page-testimonials').hide();
}
function show_custom_metabox(meta_id) {
var selector = "#" + meta_id;
if(jQuery(selector).length)
jQuery(selector).show();
}
function toggle_wp_editor(current_metabox) {
jQuery('#postdivrich').show();
switch(current_metabox) {
case 'facility':
//jQuery('#postdivrich').css("display","none");
show_custom_metabox("page-facilities");
break;
case 'services':
jQuery('#postdivrich').css("display","none");
show_custom_metabox("page-services");
break;
case 'storage':
jQuery('#postdivrich').css("display","none");
show_custom_metabox("page-storage");
break;
case 'testimonials':
jQuery('#postdivrich').css("display","none");
show_custom_metabox("page-testimonials");
break;
}
}
function get_template_html_id() {
current_metabox = jQuery('#page_template option:selected').val();
current_metabox = current_metabox.replace('template.','');
current_metabox = current_metabox.replace('.php','');
/*if(current_metabox == "default") {
current_metabox = "content-default";
}*/
return current_metabox;
}
hide_all_custom_metaboxes();
var current_metabox = get_template_html_id();
show_custom_metabox(current_metabox);
toggle_wp_editor(current_metabox);
jQuery('#page_template').bind("change", function() {
hide_all_custom_metaboxes();
show_custom_metabox(get_template_html_id());
toggle_wp_editor(get_template_html_id());
});
});
That should do the trick. Please let me know if you encounter any hick-ups.