get_field_id( 'pen_theme_color_widget' ); $field_name = $widget->get_field_name( 'pen_theme_color_widget' ); ?>

get_field_id( 'pen_theme_animation_widget' ); $field_name = $widget->get_field_name( 'pen_theme_animation_widget' ); ?>

get_field_id( 'pen_theme_animation_delay_widget' ); $field_name = $widget->get_field_name( 'pen_theme_animation_delay_widget' ); ?>

get_settings(); $class = 'class="'; if ( isset( $settings[ $instance_id ]['title'] ) && '' !== trim( $settings[ $instance_id ]['title'] ) ) { $class .= 'pen_widget_has_title '; } $current_color = ''; if ( ! empty( $settings[ $instance_id ]['pen_theme_color_widget'] ) ) { $current_color = $settings[ $instance_id ]['pen_theme_color_widget']; } // This is for default widgets on fresh installations. if ( ! empty( $parameters[0]['id'] ) && ( ! $current_color || 'automatic' === $current_color ) ) { $variables = array( 'option' => 'color_scheme', 'sidebar_id' => $parameters[0]['id'], ); $color = pen_widget_determine_default( $variables ); } if ( empty( $color ) ) { $color = 'transparent'; } if ( $current_color && 'automatic' !== $current_color ) { $color = $current_color; } $class .= 'pen_widget_' . $color . ' '; if ( false !== strpos( $color, '_flat' ) ) { $class .= 'pen_widget_' . str_replace( '_flat', '', $color ) . ' '; } if ( 'transparent' !== $color ) { $class .= 'pen_widget_not_transparent '; } $animation = 'fadeIn'; if ( ! empty( $settings[ $instance_id ]['pen_theme_animation_widget'] ) ) { $animation = $settings[ $instance_id ]['pen_theme_animation_widget']; } if ( $animation && 'none' !== $animation ) { $class .= 'pen_animate_on_scroll '; $class .= 'pen_custom_animation_' . sanitize_html_class( $animation ) . ' '; if ( ! empty( $settings[ $instance_id ]['pen_theme_animation_delay_widget'] ) ) { $animation_delay = (int) $settings[ $instance_id ]['pen_theme_animation_delay_widget']; if ( (int) $animation_delay ) { $class .= 'pen_custom_animation_delay_' . $animation_delay . ' '; } } } $parameters[0]['before_widget'] = str_ireplace( 'class="', $class, $parameters[0]['before_widget'] ); return $parameters; } add_filter( 'dynamic_sidebar_params', 'pen_widgets_custom_classes' ); } if ( ! function_exists( 'pen_widget_determine_default' ) ) { /** * Optimal default values for widget options. * * @param array $variables The variables. * * @since Pen 1.3.0 * @return string */ function pen_widget_determine_default( $variables ) { if ( empty( $variables['option'] ) || empty( $variables['sidebar_id'] ) ) { return; } if ( 'color_scheme' === $variables['option'] ) { $color_default = 'transparent'; $override_default_color = false; // These are transparent widget areas. if ( in_array( $variables['sidebar_id'], array( 'sidebar-top', 'sidebar-left', 'sidebar-right' ), true ) ) { $override_default_color = true; } elseif ( 'sidebar-bottom' === $variables['sidebar_id'] && pen_option_get( 'color_bottom_background_transparent' ) ) { $override_default_color = true; } if ( $override_default_color ) { $preset = pen_preset_get( 'color' ); switch ( $preset ) { case 'preset_1': $color_default = 'light'; break; case 'preset_2': $color_default = 'dark'; break; case 'preset_3': $color_default = 'dark'; break; case 'preset_4': $color_default = 'purple_deep'; break; case 'preset_5': $color_default = 'blue_deep'; break; case 'preset_6': $color_default = 'violet'; break; case 'preset_7': $color_default = 'dark'; break; case 'preset_8': $color_default = 'violet'; break; case 'preset_9': $color_default = 'lime'; break; case 'preset_10': $color_default = 'dark'; break; case 'preset_11': $color_default = 'light_flat'; break; case 'preset_12': $color_default = 'dark_flat'; break; case 'preset_13': $color_default = 'dark_flat'; break; case 'preset_14': $color_default = 'dark_flat'; break; case 'preset_15': $color_default = 'dark_flat'; break; default: $color_default = 'transparent'; } if ( PEN_THEME_PREVIEW ) { $preview = array( 'blue', 'dark', 'light', 'red', ); $random = wp_rand( 0, 8 ); if ( ! empty( $preview[ $random ] ) ) { return $preview[ $random ]; } } } return $color_default; } } }