__('Top Menu', 'amplifyworldwide'),
'footer-menu' => __('Footer Menu', 'amplifyworldwide'),
)
);
//====================================================================
// Add WordPress theme requirements
//====================================================================
add_action('after_setup_theme', function () {
add_theme_support('starter-content', [
// Starter content defined here
// Static front page set to Home, posts page set to Blog
'options' => [
'show_on_front' => 'page',
'page_on_front' => '{{home}}',
'page_for_posts' => '{{blog}}',
],
// Starter pages to include
'posts' => [
'home',
'about' ,
'contact',
'blog'
],
// Add pages to primary navigation menu
'nav_menus' => [
'primary_navigation' => [
'name' => __('Primary Navigation', 'amplifyworldwide'),
'items' => [
'home_link',
'page_about',
'page_blog',
'page_contact',
],
]
],
// Add test widgets to footer sidebar
'widgets' => [
'sidebar-footer' => [
'text_business_info',
'search'
]
]
]);
});
add_action( 'after_setup_theme', 'amplifyworldwide_theme_slug_setup' );
function amplifyworldwide_theme_slug_setup() {
add_theme_support( 'title-tag' );
}
add_theme_support( 'automatic-feed-links' );
if ( ! isset( $content_width ) ) {
$content_width = 900;
}
if ( is_singular() ) wp_enqueue_script( "comment-reply" );
function amplifyworldwide_wpdocs_theme_add_editor_styles() {
add_editor_style( 'custom-editor-style.css' );
}
add_action( 'admin_init', 'amplifyworldwide_wpdocs_theme_add_editor_styles' );
/**
* Add a sidebar.
*/
function amplifyworldwide_wpdocs_theme_slug_widgets_init() {
register_sidebar( array(
'name' => __( 'Main Sidebar', 'amplifyworldwide' ),
'id' => 'dynamic_sidebar',
'description' => __( 'Widgets in this area will be shown on all posts and pages.', 'amplifyworldwide' ),
'before_widget' => '
',
'after_widget' => '',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'amplifyworldwide_wpdocs_theme_slug_widgets_init' );
//====================================================================
// Add Social Media Fields to Customizer
//====================================================================
function amplifyworldwide_mytheme_customize_register( $wp_customize ) {
$wp_customize->add_section( 'mytheme_company_section' , array(
'title' => __( 'Social Media Accounts', 'amplifyworldwide' ),
'priority' => 30,
));
$wp_customize->add_setting( 'mytheme_company-instagramAccount', array(
'sanitize_callback' => 'wp_filter_nohtml_kses'
));
$wp_customize->add_control( new WP_Customize_Control(
$wp_customize,
'mytheme_company_control1',
array(
'label' => __( 'Instagram Account', 'amplifyworldwide' ),
'section' => 'mytheme_company_section',
'settings' => 'mytheme_company-instagramAccount',
'priority' => 1
)
)
);
$wp_customize->add_setting( 'mytheme_company-facebookAccount', array(
'sanitize_callback' => 'wp_filter_nohtml_kses'
));
$wp_customize->add_control( new WP_Customize_Control(
$wp_customize,
'mytheme_company_control2',
array(
'label' => __( 'Facebook Account', 'amplifyworldwide' ),
'section' => 'mytheme_company_section',
'settings' => 'mytheme_company-facebookAccount',
'priority' => 2
)
)
);
$wp_customize->add_setting( 'mytheme_company-twitterAccount', array(
'sanitize_callback' => 'wp_filter_nohtml_kses'
));
$wp_customize->add_control( new WP_Customize_Control(
$wp_customize,
'mytheme_company_control3',
array(
'label' => __( 'Twitter Account', 'amplifyworldwide' ),
'section' => 'mytheme_company_section',
'settings' => 'mytheme_company-twitterAccount',
'priority' => 2
)
)
);
$wp_customize->add_setting( 'mytheme_company-linkedinAccount', array(
'sanitize_callback' => 'wp_filter_nohtml_kses'
));
$wp_customize->add_control( new WP_Customize_Control(
$wp_customize,
'mytheme_company_control4',
array(
'label' => __( 'LinkedIn Account', 'amplifyworldwide' ),
'section' => 'mytheme_company_section',
'settings' => 'mytheme_company-linkedinAccount',
'priority' => 2
)
)
);
// ..repeat ->add_setting() and ->add_control() for mytheme_company-division
}
add_action( 'customize_register', 'amplifyworldwide_mytheme_customize_register' );
//====================================================================
// Add New Color Option in Existing Colors Section in Customizer
//====================================================================
function amplifyworldwide_diwp_customizer_add_colorPicker( $wp_customize){
// Add Settings
// Add Settings
$wp_customize->add_setting( 'pri_color', array(
'default' => '#04bfbf',
'sanitize_callback' => 'wp_filter_nohtml_kses'
));
$wp_customize->add_setting( 'sec_color', array(
'default' => '#45ace0',
'sanitize_callback' => 'wp_filter_nohtml_kses'
));
$wp_customize->add_setting( 'nav_color', array(
'default' => '#45ace0',
'sanitize_callback' => 'wp_filter_nohtml_kses'
));
// Add Controls
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'pri_color', array(
'label' => __( 'Primary Color', 'amplifyworldwide' ),
'section' => 'colors',
'settings' => 'pri_color'
)));
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'sec_color', array(
'label' => __( 'Secondary Color', 'amplifyworldwide' ),
'section' => 'colors',
'settings' => 'sec_color'
)));
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'nav_color', array(
'label' => __('Nav Bar Color', 'amplifyworldwide' ),
'section' => 'colors',
'settings' => 'nav_color'
)));
}
add_action( 'customize_register', 'amplifyworldwide_diwp_customizer_add_colorPicker' );
//====================================================================
// Hero Image and Logos
//====================================================================
function amplifyworldwide_mytheme_customize_register_heroimagelogo( $wp_customize ) {
$wp_customize->add_setting( 'mytheme_footerlogo', array(
'default' => get_theme_file_uri('assets/image/logo.jpg'), // Add Default Image URL
'sanitize_callback' => 'esc_url_raw'
));
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'mytheme_footerlogo', array(
/*
'label' => 'Footer Logo',
*/
'label' => __( 'Footer Logo', 'amplifyworldwide' ),
'priority' => 2,
/*
'section' => 'mytheme_heroimagelogo_section',
*/
'section' => 'title_tagline',
'settings' => 'mytheme_footerlogo',
'button_labels' => array(// All These labels are optional
'select' => __( 'Select Image', 'amplifyworldwide' ),
'remove' => __( 'Remove Image', 'amplifyworldwide' ),
'change' => __( 'Change Image', 'amplifyworldwide' ),
)
)));
$wp_customize->add_setting( 'mytheme_headerlogo', array(
'default' => get_theme_file_uri('https://beta.amplifyworldwide.com/wp-content/uploads/2021/05/screencapture-intercotradingco-wp-admin-edit-comments-php-2021-05-13-10_29_30.png'), // Add Default Image URL
'sanitize_callback' => 'esc_url_raw'
));
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'mytheme_headerlogo', array(
'label' => __( 'Header Logo', 'amplifyworldwide' ),
'priority' => 1,
/*
'section' => 'mytheme_heroimagelogo_section',
*/
'section' => 'title_tagline',
'settings' => 'mytheme_headerlogo',
'button_labels' => array(// All These labels are optional
'select' => __( 'Select Image', 'amplifyworldwide' ),
'remove' => __( 'Remove Image', 'amplifyworldwide' ),
'change' => __( 'Change Image', 'amplifyworldwide' ),
)
)));
}
add_action( 'customize_register', 'amplifyworldwide_mytheme_customize_register_heroimagelogo' );