Skip to content

Commit

Permalink
version 1.2.7
Browse files Browse the repository at this point in the history
* New options for main menu color
* New mobile menu position to use a different menu between desktop and mobile
* New login widget
* Move all customizer css from php file to css variables to reduce page impact, load time and increase performance
* Fix search widget button alignment
* Fix issue with header background color
* Enanched support to: Group block, Cover block, WooCommerce products block
* Improve cart shipping calculator css
* Refactor all scss files
  • Loading branch information
francgrasso committed May 22, 2020
1 parent 3fa840e commit 47d2254
Show file tree
Hide file tree
Showing 18 changed files with 457 additions and 25 deletions.
18 changes: 16 additions & 2 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,22 @@ function yith_proteo_setup() {
// This theme uses wp_nav_menu() in one location.
register_nav_menus(
array(
'menu-1' => esc_html__( 'Primary', 'yith-proteo' ),
'primary' => esc_html__( 'Primary', 'yith-proteo' ),
'mobile' => esc_html__( 'Mobile Menu', 'yith-proteo' ),
)
);

/**
* Fix empty menu locations
*/
$menu_locations = get_theme_mod( 'nav_menu_locations' );
if ( ! isset( $menu_locations['primary'] ) && isset( $menu_locations['menu-1'] ) ) {
set_theme_mod( 'nav_menu_locations', array_merge( $menu_locations, array( 'primary' => $menu_locations['menu-1'] ) ) );
}
if ( ! isset( $menu_locations['mobile'] ) ) {
set_theme_mod( 'nav_menu_locations', array_merge( $menu_locations, array( 'mobile' => $menu_locations['primary'] ) ) );
}

/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
Expand Down Expand Up @@ -189,7 +201,9 @@ function yith_proteo_content_width() {
/**
* Load TGM class
*/
require_once get_template_directory() . '/third-party/classes/class-tgm-plugin-activation.php';
if ( ! class_exists( 'TGM_Plugin_Activation' ) ) {
require_once get_template_directory() . '/third-party/classes/class-tgm-plugin-activation.php';
}

/**
* Various functions
Expand Down
20 changes: 18 additions & 2 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,16 @@
} else {
$hide_header = $post ? get_post_meta( $post->ID, 'yith_proteo_remove_header_and_footer', true ) : 'off';
}
$slider = '';
if ( defined( 'YITH_SLIDER_FOR_PAGE_BUILDERS' ) ) {
if ( $post ) {
$slider = get_post_meta( $post->ID, 'header_slider', true );
}
}
if ( 'on' != $hide_header ) :
?>
<header id="masthead"
class="site-header <?php echo esc_attr( get_theme_mod( 'yith_proteo_header_layout', 'left_logo_navigation_inline' ) ); ?> <?php echo esc_attr( get_theme_mod( 'yith_proteo_header_fullwidth', 'no' ) == 'yes' ? 'fullwidth-header' : '' ); ?>" <?php yith_proteo_custom_header_style(); ?>>
class="site-header <?php echo esc_attr( get_theme_mod( 'yith_proteo_header_layout', 'left_logo_navigation_inline' ) ); ?> <?php echo esc_attr( get_theme_mod( 'yith_proteo_header_fullwidth', 'no' ) == 'yes' ? 'fullwidth-header' : '' ); ?> <?php echo esc_attr( $slider && '' != $slider ? 'with-header-slider' : '' ); ?>" <?php yith_proteo_custom_header_style(); ?>>
<?php
if ( get_theme_mod( 'yith_proteo_topbar_enable', 'no' ) == 'yes' ) {
get_template_part( 'template-parts/topbar' );
Expand Down Expand Up @@ -99,8 +105,18 @@ class="site-header <?php echo esc_attr( get_theme_mod( 'yith_proteo_header_layou
<?php
wp_nav_menu(
array(
'theme_location' => 'menu-1',
'theme_location' => 'mobile',
'menu_id' => 'mobile-menu',
'container_id' => 'mobile-nav-menu',
)
);
?>
<?php
wp_nav_menu(
array(
'theme_location' => 'primary',
'menu_id' => 'primary-menu',
'container_id' => 'primary-nav-menu',
)
);
?>
Expand Down
7 changes: 7 additions & 0 deletions img/user.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions inc/customizer-inline-style.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ function yith_proteo_inline_style() {
$footer_bg_color = get_theme_mod( 'yith_proteo_footer_background_color', '#f7f7f7' );
$footer_credits_bg_color = get_theme_mod( 'yith_proteo_footer_credits_background_color', '#f0f0f0' );

$header_menu_color = get_theme_mod( 'yith_proteo_header_main_menu_color', '#404040' );
$header_menu_hover_color = get_theme_mod( 'yith_proteo_header_main_menu_hover_color', '#448a85' );

$base_font_size = get_theme_mod( 'yith_proteo_base_font_size', 16 );
$base_font_color = get_theme_mod( 'yith_proteo_base_font_color', '#404040' );
$h1_font_size = get_theme_mod( 'yith_proteo_h1_font_size', 70 );
Expand Down Expand Up @@ -92,6 +95,8 @@ function yith_proteo_inline_style() {
--proteo-main_color_shade: {$main_color_shade};
--proteo-general_link_hover_color: {$general_link_hover_color};
--proteo-header_bg_color: {$header_bg_color};
--proteo-header_menu_color: {$header_menu_color};
--proteo-header_menu_hover_color: {$header_menu_hover_color};
--proteo-topbar_bg_color: {$topbar_bg_color};
--proteo-footer_bg_color: {$footer_bg_color};
--proteo-footer_credits_bg_color: {$footer_credits_bg_color};
Expand Down
38 changes: 38 additions & 0 deletions inc/customizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,44 @@ function yith_proteo_customize_register( $wp_customize ) {
)
);

// Header menu color.
$wp_customize->add_setting(
'yith_proteo_header_main_menu_color',
array(
'default' => get_theme_mod( 'yith_proteo_base_font_color', '#404040' ),
'sanitize_callback' => 'sanitize_hex_color', // validates 3 or 6 digit HTML hex color code.
)
);
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
'yith_proteo_header_main_menu_color',
array(
'label' => esc_html__( 'Header menu color', 'yith-proteo' ),
'section' => 'yith_proteo_header_management',
)
)
);

// Header menu color hover.
$wp_customize->add_setting(
'yith_proteo_header_main_menu_hover_color',
array(
'default' => get_theme_mod( 'yith_proteo_main_color_shade', '#448a85' ),
'sanitize_callback' => 'sanitize_hex_color', // validates 3 or 6 digit HTML hex color code.
)
);
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
'yith_proteo_header_main_menu_hover_color',
array(
'label' => esc_html__( 'Header menu :hover color', 'yith-proteo' ),
'section' => 'yith_proteo_header_management',
)
)
);

/**
* Add footer sidebar management.
*/
Expand Down
18 changes: 16 additions & 2 deletions inc/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,15 +270,29 @@ function yith_proteo_register_required_plugins() {
);

$config = array(
'id' => 'yith-proteo', // Unique ID for hashing notices for multiple instances of TGMPA.
'id' => 'yith-proteo', // Unique ID for hashing notices for multiple instances of TGMPA.
'default_path' => '', // Default absolute path to bundled plugins.
'menu' => 'tgmpa-install-plugins', // Menu slug.
'has_notices' => true, // Show admin notices or not.
'dismissable' => true, // If false, a user cannot dismiss the nag message.
'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag.
'is_automatic' => true, // Automatically activate plugins after installation or not.
'is_automatic' => true, // Automatically activate plugins after installation or not.
'message' => '', // Message to output right before the plugins table.
);

tgmpa( $plugins, $config );
}

if ( ! function_exists( 'yith_proteo_get_user_username' ) ) {
/**
* Get current user display name
*
* @return string
*/
function yith_proteo_get_user_username() {
$current_user = wp_get_current_user();
$username = ( isset( $current_user->billing_first_name ) && '' != $current_user->billing_first_name ) ? $current_user->billing_first_name : $current_user->display_name;

return $username;
}
}
12 changes: 12 additions & 0 deletions inc/widgets.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,15 @@ function yith_proteo_register_social_icons_widget() {
}

add_action( 'widgets_init', 'yith_proteo_register_social_icons_widget' );

// Include YITH_Proteo_Account widget
require get_template_directory() . '/inc/widgets/class-yith-proteo-account-widget.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound

/**
* Register YITH_Proteo_Account widget
*/
function yith_proteo_account_widget_registration() {
register_widget( 'YITH_Proteo_Account_Widget' );
}

add_action( 'widgets_init', 'yith_proteo_account_widget_registration' );
Loading

0 comments on commit 47d2254

Please sign in to comment.