Created
October 16, 2019 19:45
-
-
Save iamandrewpeters/8d2c85ed7a02bcae0a444036e6b2cc5c to your computer and use it in GitHub Desktop.
FM Settings Setup
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 Settings Pages to Customizer | |
//Styles Page | |
add_filter( 'mb_settings_pages', function ( $settings_pages ) { | |
$settings_pages[] = array( | |
'id' => 'fm_styles_panel', | |
'option_name' => 'theme_mods_page-builder-framework', | |
'menu_title' => 'Style Settings', | |
'parent' => 'themes.php', | |
'customizer' => 'true', | |
); | |
return $settings_pages; | |
} ); | |
//Church Info Page | |
add_filter( 'mb_settings_pages', function ( $settings_pages ) { | |
$settings_pages[] = array( | |
'id' => 'fm_church_info_panel', | |
'option_name' => 'theme_mods_page-builder-framework', | |
'menu_title' => 'Church Information', | |
'parent' => 'themes.php', | |
'customizer' => 'true', | |
); | |
return $settings_pages; | |
} ); | |
// | |
add_filter( 'rwmb_meta_boxes', function ( $meta_boxes ) { | |
$meta_boxes[] = array( | |
'id' => 'fm_button_typo_panel', | |
'title' => 'Buttons', | |
'panel' => 'typography_panel', // THIS | |
'fields' => array( | |
array( | |
'name' => 'Heading H2 size', | |
'id' => 'fm_heading_size', | |
'type' => 'text', | |
// Cloneable (i.e. have multiple value)? | |
'clone' => false, | |
// Placeholder | |
'placeholder' => 'Use default value', | |
// Input size | |
'size' => 7, | |
), | |
array( | |
'name' => 'Button Unit', | |
'id' => 'fm_button_unit', | |
'type' => 'button_group', | |
'options' => array( | |
'px' => 'px', | |
'em' => 'em', | |
'rem' => 'rem', | |
), | |
'inline' => true, // true (horizontal) / false (vertical) | |
'multiple' => false, // multiple choice | |
), | |
array( | |
'name' => 'Font Family', | |
'id' => 'fm_google_font', | |
'type' => 'select', | |
// Array of 'value' => 'Label' pairs | |
'options' => array( | |
'Modak' => 'Modak', | |
'Oswald' => 'Oswald', | |
'Long Cang' => 'Long Cang', | |
), | |
// Allow to select multiple value? | |
'multiple' => false, // true / false | |
// Placeholder text | |
'placeholder' => 'Use default font', | |
// Display "Select All / None" button? | |
'select_all_none' => false, // true / false | |
), | |
), | |
); | |
return $meta_boxes; | |
} ); | |
//Add Buttons Fields | |
add_filter( 'rwmb_meta_boxes', 'fm_button_fields' ); | |
function fm_button_fields( $meta_boxes ) { | |
$prefix = ''; | |
$meta_boxes[] = array ( | |
'title' => esc_html__( 'Buttons', 'text-domain' ), | |
'id' => 'fm_button_colors', | |
'fields' => array( | |
array ( | |
'id' => $prefix . 'heading_u6cs92mu54f', | |
'type' => 'heading', | |
'name' => esc_html__( 'Primary Button', 'text-domain' ), | |
), | |
array ( | |
'id' => $prefix . 'fm_primary_button_color', | |
'name' => esc_html__( 'Button Color', 'text-domain' ), | |
'type' => 'color', | |
'size' => 7, | |
'alpha_channel' => true, | |
), | |
array ( | |
'id' => $prefix . 'fm_primary_button_color_hover', | |
'name' => esc_html__( 'Hover', 'text-domain' ), | |
'type' => 'color', | |
'size' => 7, | |
'alpha_channel' => true, | |
), | |
array ( | |
'id' => $prefix . 'fm_primary_button_text_color', | |
'name' => esc_html__( 'Text Color', 'text-domain' ), | |
'type' => 'color', | |
'size' => 7, | |
'alpha_channel' => true, | |
), | |
array ( | |
'id' => $prefix . 'fm_primary_button_text_color_hover', | |
'name' => esc_html__( 'Hover', 'text-domain' ), | |
'type' => 'color', | |
'size' => 7, | |
'alpha_channel' => true, | |
), | |
array ( | |
'id' => $prefix . 'fm_button_radius', | |
'type' => 'slider', | |
'name' => esc_html__( 'Button Radius', 'text-domain' ), | |
), | |
array ( | |
'id' => $prefix . 'fm_button_border_width', | |
'type' => 'slider', | |
'name' => esc_html__( 'Border Width', 'text-domain' ), | |
), | |
array ( | |
'id' => $prefix . 'fm_primary_button_border_color', | |
'name' => esc_html__( 'Border Color', 'text-domain' ), | |
'type' => 'color', | |
'size' => 7, | |
'alpha_channel' => true, | |
'visible' => array( | |
'when' => array( | |
array ( | |
0 => 'fm_button_border_width', | |
1 => '>=', | |
2 => 1, | |
), | |
), | |
'relation' => 'and', | |
), | |
), | |
array ( | |
'id' => $prefix . 'fm_primary_button_border_color_hover', | |
'name' => esc_html__( 'Hover', 'text-domain' ), | |
'type' => 'color', | |
'size' => 7, | |
'alpha_channel' => true, | |
'visible' => array( | |
'when' => array( | |
array ( | |
0 => 'fm_button_border_width', | |
1 => '>=', | |
2 => 1, | |
), | |
), | |
'relation' => 'and', | |
), | |
), | |
), | |
'settings_pages' => array( | |
0 => 'fm_styles_panel', | |
), | |
); | |
return $meta_boxes; | |
} | |
// Add Accent Color Fields | |
add_filter( 'rwmb_meta_boxes', 'fm_accent_color_fields' ); | |
function fm_accent_color_fields( $meta_boxes ) { | |
$prefix = ''; | |
$meta_boxes[] = array ( | |
'title' => esc_html__( 'Accent Colors', 'text-domain' ), | |
'id' => 'fm_accent_color_choices', | |
'fields' => array( | |
array ( | |
'id' => $prefix . 'fm_accent_color', | |
'name' => esc_html__( 'Accent Color', 'text-domain' ), | |
'type' => 'color', | |
'size' => 7, | |
), | |
array ( | |
'id' => $prefix . 'fm_accent_color_hover', | |
'name' => esc_html__( 'Hover', 'text-domain' ), | |
'type' => 'color', | |
'size' => 7, | |
), | |
array ( | |
'id' => $prefix . 'fm_light_color', | |
'name' => esc_html__( 'Light Color', 'text-domain' ), | |
'type' => 'color', | |
'size' => 7, | |
), | |
array ( | |
'id' => $prefix . 'fm_cark_color', | |
'name' => esc_html__( 'Dark Color', 'text-domain' ), | |
'type' => 'color', | |
'size' => 7, | |
), | |
array ( | |
'id' => $prefix . 'fm_light_overlay', | |
'name' => esc_html__( 'Light Overlay', 'text-domain' ), | |
'type' => 'color', | |
'size' => 7, | |
'alpha_channel' => true, | |
), | |
array ( | |
'id' => $prefix . 'fm_dark_overlay', | |
'name' => esc_html__( 'Dark Overlay', 'text-domain' ), | |
'type' => 'color', | |
'size' => 7, | |
'alpha_channel' => true, | |
), | |
), | |
'settings_pages' => array( | |
0 => 'fm_styles_panel', | |
), | |
); | |
return $meta_boxes; | |
} | |
//Add Menu Color Options | |
add_filter( 'rwmb_meta_boxes', 'fm_menu_color_fields' ); | |
function fm_menu_color_fields ( $meta_boxes ) { | |
$prefix = ''; | |
$meta_boxes[] = array ( | |
'title' => esc_html__( 'Menu', 'text-domain' ), | |
'id' => 'fm_menu_colors', | |
'fields' => array( | |
array ( | |
'id' => $prefix . 'heading_jtl5gl8n59e', | |
'type' => 'heading', | |
'name' => esc_html__( 'Main Menu', 'text-domain' ), | |
), | |
array ( | |
'id' => $prefix . 'fm_menu_link_color', | |
'name' => esc_html__( 'Link Color', 'text-domain' ), | |
'type' => 'color', | |
'size' => 7, | |
), | |
array ( | |
'id' => $prefix . 'fm_menu_link_color_hover', | |
'name' => esc_html__( 'Hover', 'text-domain' ), | |
'type' => 'color', | |
'size' => 7, | |
), | |
array ( | |
'id' => $prefix . 'heading_jtl5gl8n59e_mamgiq52fwl', | |
'type' => 'heading', | |
'name' => esc_html__( 'Sub Menu', 'text-domain' ), | |
), | |
array ( | |
'id' => $prefix . 'fm_submenu_link_color', | |
'name' => esc_html__( 'Link Color', 'text-domain' ), | |
'type' => 'color', | |
'size' => 7, | |
), | |
array ( | |
'id' => $prefix . 'fm_submenu_link_color_hover', | |
'name' => esc_html__( 'Hover', 'text-domain' ), | |
'type' => 'color', | |
'size' => 7, | |
), | |
array ( | |
'id' => $prefix . 'fm_submenu_bg_color', | |
'name' => esc_html__( 'Background Color', 'text-domain' ), | |
'type' => 'color', | |
'size' => 7, | |
), | |
array ( | |
'id' => $prefix . 'fm_submenu_bg_color_hover', | |
'name' => esc_html__( 'Hover)', 'text-domain' ), | |
'type' => 'color', | |
'size' => 7, | |
), | |
), | |
'settings_pages' => array( | |
0 => 'fm_styles_panel', | |
), | |
); | |
return $meta_boxes; | |
} | |
//Identify Fields for Logos and Such | |
add_filter( 'rwmb_meta_boxes', 'fm_identity_fields' ); | |
function fm_identity_fields ( $meta_boxes ) { | |
$prefix = ''; | |
$meta_boxes[] = array ( | |
'title' => esc_html__( 'Identity', 'text-domain' ), | |
'id' => 'fm_identity', | |
'fields' => array( | |
array ( | |
'id' => $prefix . 'heading_qnuhohtc1cd', | |
'type' => 'heading', | |
'name' => esc_html__( 'Images & Branding', 'text-domain' ), | |
), | |
array ( | |
'id' => $prefix . 'fm_church_logo', | |
'type' => 'single_image', | |
'name' => esc_html__( 'Logo', 'text-domain' ), | |
), | |
array ( | |
'id' => $prefix . 'fm_church_footer_logo', | |
'type' => 'single_image', | |
'name' => esc_html__( 'Light Logo', 'text-domain' ), | |
'desc' => esc_html__( 'This logo is usually a lighter version and used in the footer area.', 'text-domain' ), | |
), | |
array ( | |
'id' => $prefix . 'fm_church_site_icon', | |
'type' => 'single_image', | |
'name' => esc_html__( 'Icon', 'text-domain' ), | |
'desc' => esc_html__( 'Square image. Used as Favicon.', 'text-domain' ), | |
), | |
), | |
'settings_pages' => array( | |
0 => 'fm_church_info_panel', | |
), | |
); | |
return $meta_boxes; | |
} | |
//Church Basic Info | |
add_filter( 'rwmb_meta_boxes', 'fm_basic_info_fields' ); | |
function fm_basic_info_fields( $meta_boxes ) { | |
$prefix = ''; | |
$meta_boxes[] = array ( | |
'title' => esc_html__( 'Basic Info', 'text-domain' ), | |
'id' => 'fm_basic_info', | |
'fields' => array( | |
array ( | |
'id' => $prefix . 'fm_church_name', | |
'type' => 'text', | |
'name' => esc_html__( 'Church Name', 'text-domain' ), | |
), | |
array ( | |
'id' => $prefix . 'fm_church_address', | |
'type' => 'text', | |
'name' => esc_html__( 'Street Address', 'text-domain' ), | |
), | |
array ( | |
'id' => $prefix . 'fm_church_city', | |
'type' => 'text', | |
'name' => esc_html__( 'City', 'text-domain' ), | |
), | |
array ( | |
'id' => $prefix . 'fm_church_state', | |
'type' => 'text', | |
'name' => esc_html__( 'State', 'text-domain' ), | |
), | |
array ( | |
'id' => $prefix . 'fm_church_zip', | |
'type' => 'text', | |
'name' => esc_html__( 'Zip', 'text-domain' ), | |
), | |
), | |
'settings_pages' => array( | |
0 => 'fm_church_info_panel', | |
), | |
); | |
return $meta_boxes; | |
} | |
//Basic Contact Info | |
add_filter( 'rwmb_meta_boxes', 'fm_basic_contact_fields' ); | |
function fm_basic_contact_fields( $meta_boxes ) { | |
$prefix = ''; | |
$meta_boxes[] = array ( | |
'title' => esc_html__( 'Contact Info', 'text-domain' ), | |
'id' => 'fm_contact_info', | |
'fields' => array( | |
array ( | |
'id' => $prefix . 'fm_main_contact_email', | |
'name' => esc_html__( 'Email', 'text-domain' ), | |
'type' => 'email', | |
), | |
array ( | |
'id' => $prefix . 'fm_church_text', | |
'type' => 'text', | |
'name' => esc_html__( 'Phone', 'text-domain' ), | |
), | |
), | |
'settings_pages' => array( | |
0 => 'fm_church_info_panel', | |
), | |
); | |
return $meta_boxes; | |
} | |
add_filter( 'rwmb_meta_boxes', 'fm_church_socials_fields' ); | |
function fm_church_socials_fields( $meta_boxes ) { | |
$prefix = ''; | |
$meta_boxes[] = array ( | |
'title' => esc_html__( 'Socials', 'text-domain' ), | |
'id' => 'fm_socials_settings', | |
'fields' => array( | |
array ( | |
'id' => $prefix . 'fm_facebook_link', | |
'type' => 'url', | |
'name' => esc_html__( 'Facebook', 'text-domain' ), | |
), | |
array ( | |
'id' => $prefix . 'fm_insta_link', | |
'type' => 'url', | |
'name' => esc_html__( 'Instagram', 'text-domain' ), | |
), | |
array ( | |
'id' => $prefix . 'fm_twitter_link', | |
'type' => 'url', | |
'name' => esc_html__( 'Twitter', 'text-domain' ), | |
), | |
array ( | |
'id' => $prefix . 'fm_yt_link', | |
'type' => 'url', | |
'name' => esc_html__( 'Youtube', 'text-domain' ), | |
), | |
array ( | |
'id' => $prefix . 'fm_vimeo_link', | |
'type' => 'url', | |
'name' => esc_html__( 'Vimeo', 'text-domain' ), | |
), | |
), | |
'settings_pages' => array( | |
0 => 'fm_church_info_panel', | |
), | |
); | |
return $meta_boxes; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment