예제 #1
0
function x_add_portfolio_item_meta_boxes()
{
    $meta_box = array('id' => 'x-meta-box-portfolio-item', 'title' => __('Portfolio Item Settings', '__x__'), 'description' => __('Select the appropriate options for your portfolio item.', '__x__'), 'page' => 'x-portfolio', 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('name' => __('Body CSS Class(es)', '__x__'), 'desc' => __('Add a custom CSS class to the <body> element. Separate multiple class names with a space.', '__x__'), 'id' => '_x_entry_body_css_class', 'type' => 'text', 'std' => ''), array('name' => __('Alternate Index Title', '__x__'), 'desc' => __('Filling out this text input will replace the standard title on all index pages (i.e. blog, category archives, search, et cetera) with this one.', '__x__'), 'id' => '_x_entry_alternate_index_title', 'type' => 'text', 'std' => ''), array('name' => __('Portfolio Parent', '__x__'), 'desc' => __('Assign the parent portfolio page for this portfolio item. This will be used in various places throughout the theme such as your breadcrumbs. If "Default" is selected then the first page with the "Layout - Portfolio" template assigned to it will be used.', '__x__'), 'id' => '_x_portfolio_parent', 'type' => 'select-portfolio-parent', 'std' => 'Default'), array('name' => __('Media Type', '__x__'), 'desc' => __('Select which kind of media you want to display for your portfolio. If selecting a "Gallery," simply upload your images to this post and organize them in the order you want them to display.', '__x__'), 'id' => '_x_portfolio_media', 'type' => 'radio', 'std' => 'Image', 'options' => array('Image', 'Gallery', 'Video')), array('name' => __('Featured Content', '__x__'), 'desc' => __('Select "Media" if you would like to show your video or gallery on the index page in place of the featured image.', '__x__'), 'id' => '_x_portfolio_index_media', 'type' => 'radio', 'std' => 'Thumbnail', 'options' => array('Thumbnail', 'Media')), array('name' => __('Project Link', '__x__'), 'desc' => __('Provide an external link to the project you worked on if one is available.', '__x__'), 'id' => '_x_portfolio_project_link', 'type' => 'text', 'std' => ''), array('name' => __('Background Image(s)', '__x__'), 'desc' => __('Click the button to upload your background image(s), or enter them in manually using the text field above. Loading multiple background images will create a slideshow effect. To clear, delete the image URLs from the text field and save your page.', '__x__'), 'id' => '_x_entry_bg_image_full', 'type' => 'uploader', 'std' => ''), array('name' => __('Background Image(s) Fade', '__x__'), 'desc' => __('Set a time in milliseconds for your image(s) to fade in. To disable this feature, set the value to "0."', '__x__'), 'id' => '_x_entry_bg_image_full_fade', 'type' => 'text', 'std' => '750'), array('name' => __('Background Images Duration', '__x__'), 'desc' => __('Only applicable if multiple images are selected, creating a background image slider. Set a time in milliseconds for your images to remain on screen.', '__x__'), 'id' => '_x_entry_bg_image_full_duration', 'type' => 'text', 'std' => '7500')));
    x_add_meta_box($meta_box);
    //
    // Video.
    //
    $meta_box = array('id' => 'x-meta-box-portfolio-item-video', 'title' => __('Video Portfolio Item Settings', '__x__'), 'description' => __('These settings enable you to embed videos into your portfolio items.', '__x__'), 'page' => 'x-portfolio', 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('name' => __('Video Aspect Ratio', '__x__'), 'desc' => __('If selecting "Video," choose the aspect ratio you would like for your video.', '__x__'), 'id' => '_x_portfolio_aspect_ratio', 'type' => 'select', 'std' => '16:9', 'options' => array('16:9', '5:3', '5:4', '4:3', '3:2')), array('name' => __('M4V File URL', '__x__'), 'desc' => __('If selecting "Video," place the URL to your .m4v video file here.', '__x__'), 'id' => '_x_portfolio_m4v', 'type' => 'text', 'std' => ''), array('name' => __('OGV File URL', '__x__'), 'desc' => __('If selecting "Video," place the URL to your .ogv video file here.', '__x__'), 'id' => '_x_portfolio_ogv', 'type' => 'text', 'std' => ''), array('name' => __('Embedded Video Code', '__x__'), 'desc' => __('If you are using something other than self hosted video such as YouTube, Vimeo, or Wistia, paste the embed code here. This field will override the above.', '__x__'), 'id' => '_x_portfolio_embed', 'type' => 'textarea', 'std' => '')));
    x_add_meta_box($meta_box);
}
// =============================================================================
$meta_box_appearance_general = array('id' => 'x-email-forms-appearance-general', 'title' => __('Appearance (General)', '__x__'), 'description' => __('Specify your desired general appearance settings for the form.', '__x__'), 'page' => 'x-email-forms', 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('name' => __('Custom Class', '__x__'), 'desc' => __('This will be applied to the containing element so you can target this form specifically with CSS.', '__x__'), 'id' => $id . '_class', 'type' => 'text', 'std' => ''), array('name' => __('Font Size', '__x__'), 'desc' => __('Allows you to determine the overall font size for this form. Larger fonts will result in larger inputs.', '__x__'), 'id' => $id . '_font_size', 'type' => 'text', 'std' => '18px'), array('name' => __('Max Width', '__x__'), 'desc' => __('Specify the maximum width of your form.', '__x__'), 'id' => $id . '_max_width', 'type' => 'text', 'std' => '250px'), array('name' => __('Custom Styling', '__x__'), 'desc' => __('Turning on custom styling will allow you to have greater flexibility over the appearance of your form.', '__x__'), 'id' => $id . '_custom_styling', 'type' => 'radio', 'std' => 'No', 'options' => array('Yes', 'No'))));
// Appearance (Form Container)
// =============================================================================
$meta_box_appearance_form_container = array('id' => 'x-email-forms-appearance-form-container', 'title' => __('Appearance (Form Container)', '__x__'), 'description' => __('Specify your desired appearance settings for the form container.', '__x__'), 'page' => 'x-email-forms', 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('name' => __('Inner Container', '__x__'), 'desc' => __('Choose whether or not you would like an inner container element placed around your form.', '__x__'), 'id' => $id . '_inner_container', 'type' => 'radio', 'std' => 'No', 'options' => array('Yes', 'No')), array('name' => __('Remove Margin', '__x__'), 'desc' => __('Choose whether or not you would like to remove the margin. This is good to keep if placed on a standard page or post, but if you are creating a custom homepage and using this as a fullwidth content band, then it is typically best to remove this.', '__x__'), 'id' => $id . '_remove_margin', 'type' => 'radio', 'std' => 'No', 'options' => array('Yes', 'No')), array('name' => __('Border', '__x__'), 'desc' => __('Optionally include a subtle border around your form container. Select which sides you would like it to appear on (if any).', '__x__'), 'id' => $id . '_border', 'type' => 'select', 'std' => 'None', 'options' => array('None', 'Top', 'Left', 'Right', 'Bottom', 'Vertical', 'Horizontal', 'All')), array('name' => __('Padding', '__x__'), 'desc' => __('Specify the padding for your form container. You can use this like a normal CSS "padding" property and set all sides at once (e.g. 40px), individual sides (e.g. 45px 60px 50px 60px), et cetera.', '__x__'), 'id' => $id . '_padding', 'type' => 'text', 'std' => '45px'), array('name' => __('Background Option', '__x__'), 'desc' => __('Choose what type of background you would like to have for your form.', '__x__'), 'id' => $id . '_bg_option', 'type' => 'select', 'std' => 'Transparent', 'options' => array('Transparent', 'Color', 'Pattern', 'Image', 'Video')), array('name' => __('Background Color', '__x__'), 'desc' => __('Select the background color for your form.', '__x__'), 'id' => $id . '_bg_color', 'type' => 'color', 'std' => '#ffffff'), array('name' => __('Background Pattern', '__x__'), 'desc' => __('Use this field to upload your repeatable background pattern.', '__x__'), 'id' => $id . '_bg_pattern', 'type' => 'uploader', 'std' => ''), array('name' => __('Background Image', '__x__'), 'desc' => __('Use this field to upload your background image.', '__x__'), 'id' => $id . '_bg_image', 'type' => 'uploader', 'std' => ''), array('name' => __('Parallax', '__x__'), 'desc' => __('Choose whether or not you would like a parallax effect to be applied to your background pattern or image.', '__x__'), 'id' => $id . '_bg_parallax', 'type' => 'radio', 'std' => 'No', 'options' => array('Yes', 'No')), array('name' => __('Background Video', '__x__'), 'desc' => __('Input the .mp4 URL to a video you would like to use as your background.', '__x__'), 'id' => $id . '_bg_video', 'type' => 'text', 'std' => ''), array('name' => __('Background Video Poster', '__x__'), 'desc' => __('Use this field to upload your background video poster, which will be used on mobile devices instead of your background video for performance reasons.', '__x__'), 'id' => $id . '_bg_video_poster', 'type' => 'uploader', 'std' => '')));
// Appearance (Form)
// =============================================================================
$meta_box_appearance_form = array('id' => 'x-email-forms-appearance-form', 'title' => __('Appearance (Form)', '__x__'), 'description' => __('Specify your desired appearance settings for the form.', '__x__'), 'page' => 'x-email-forms', 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('name' => __('Title', '__x__'), 'desc' => __('Select your color.', '__x__'), 'id' => $id . '_title_color', 'type' => 'color', 'std' => '#ffffff'), array('name' => __('Labels', '__x__'), 'desc' => __('Select your color.', '__x__'), 'id' => $id . '_label_color', 'type' => 'color', 'std' => '#ffffff'), array('name' => __('Button Shape', '__x__'), 'desc' => __('Select your button shape for the form.', '__x__'), 'id' => $id . '_button_shape', 'type' => 'select', 'std' => 'Rounded', 'options' => array('Square', 'Rounded', 'Pill')), array('name' => __('Button Style', '__x__'), 'desc' => __('Select your button style for the form.', '__x__'), 'id' => $id . '_button_style', 'type' => 'select', 'std' => '3D', 'options' => array('3D', 'Flat', 'Transparent')), array('name' => __('Button Text', '__x__'), 'desc' => __('Select your color.', '__x__'), 'id' => $id . '_button_text_color', 'type' => 'color', 'std' => '#ffffff'), array('name' => __('Button Background', '__x__'), 'desc' => __('Select your color.', '__x__'), 'id' => $id . '_button_bg_color', 'type' => 'color', 'std' => '#ff2a13'), array('name' => __('Button Border', '__x__'), 'desc' => __('Select your color.', '__x__'), 'id' => $id . '_button_border_color', 'type' => 'color', 'std' => '#ac1100'), array('name' => __('Button Bottom', '__x__'), 'desc' => __('Select your color.', '__x__'), 'id' => $id . '_button_bottom_color', 'type' => 'color', 'std' => '#a71000'), array('name' => __('Button Text Hover', '__x__'), 'desc' => __('Select your color.', '__x__'), 'id' => $id . '_button_text_color_hover', 'type' => 'color', 'std' => '#ffffff'), array('name' => __('Button Background Hover', '__x__'), 'desc' => __('Select your color.', '__x__'), 'id' => $id . '_button_bg_color_hover', 'type' => 'color', 'std' => '#ef2201'), array('name' => __('Button Border Hover', '__x__'), 'desc' => __('Select your color.', '__x__'), 'id' => $id . '_button_border_color_hover', 'type' => 'color', 'std' => '#600900'), array('name' => __('Button Bottom Hover', '__x__'), 'desc' => __('Select your color.', '__x__'), 'id' => $id . '_button_bottom_color_hover', 'type' => 'color', 'std' => '#a71000')));
// Sidebar
// =============================================================================
function x_email_forms_sidebar_meta_box()
{
    ?>
  <p>Once you have finished setting up your form, head back over to the Email Forms list to locate your generated shortcode.</p>
  <p><a href="<?php 
    echo admin_url('admin.php?page=x-extensions-email-forms');
    ?>
" class="button">Go to Email Forms List</a></p>
<?php 
}
// Add Meta Boxes
// =============================================================================
if (function_exists('x_add_meta_box')) {
    x_add_meta_box($meta_box_form);
    x_add_meta_box($meta_box_appearance_general);
    x_add_meta_box($meta_box_appearance_form_container);
    x_add_meta_box($meta_box_appearance_form);
    add_meta_box('x-email-forms-sidebar', __('After Publication', '__x__'), 'x_email_forms_sidebar_meta_box', 'x-email-forms', 'side', 'default');
} else {
    $this->warn_x_required();
}