first commit

This commit is contained in:
DESKTOP-GBA0BK8\Admin
2023-04-08 12:19:53 -04:00
commit 7c8c8b1c76
4586 changed files with 2050693 additions and 0 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,456 @@
<?php
/**
* Footer Bottom Customizer Options
*
* @package OceanWP WordPress theme
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'OceanWP_Footer_Bottom_Customizer' ) ) :
/**
* Settings for footer bottom
*/
class OceanWP_Footer_Bottom_Customizer {
/**
* Setup class.
*
* @since 1.0
*/
public function __construct() {
add_action( 'customize_register', array( $this, 'customizer_options' ) );
add_filter( 'ocean_head_css', array( $this, 'head_css' ) );
}
/**
* Customizer options
*
* @param WP_Customize_Manager $wp_customize Reference to WP_Customize_Manager.
* @since 1.0.0
*/
public function customizer_options( $wp_customize ) {
/**
* Section
*/
$section = 'ocean_footer_bottom_section';
$wp_customize->add_section(
$section,
array(
'title' => esc_html__( 'Footer Bottom', 'oceanwp' ),
'priority' => 210,
)
);
/**
* Enable Footer Bottom
*/
$wp_customize->add_setting(
'ocean_footer_bottom',
array(
'default' => true,
'sanitize_callback' => 'oceanwp_sanitize_checkbox',
)
);
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'ocean_footer_bottom',
array(
'label' => esc_html__( 'Enable Footer Bottom', 'oceanwp' ),
'type' => 'checkbox',
'section' => $section,
'settings' => 'ocean_footer_bottom',
'priority' => 10,
)
)
);
/**
* Footer Bottom Visibility
*/
$wp_customize->add_setting(
'ocean_bottom_footer_visibility',
array(
'transport' => 'postMessage',
'default' => 'all-devices',
'sanitize_callback' => 'oceanwp_sanitize_select',
)
);
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'ocean_bottom_footer_visibility',
array(
'label' => esc_html__( 'Visibility', 'oceanwp' ),
'type' => 'select',
'section' => $section,
'settings' => 'ocean_bottom_footer_visibility',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_footer_bottom',
'choices' => array(
'all-devices' => esc_html__( 'Show On All Devices', 'oceanwp' ),
'hide-tablet' => esc_html__( 'Hide On Tablet', 'oceanwp' ),
'hide-mobile' => esc_html__( 'Hide On Mobile', 'oceanwp' ),
'hide-tablet-mobile' => esc_html__( 'Hide On Tablet & Mobile', 'oceanwp' ),
),
)
)
);
/**
* Footer Bottom Copyright
*/
$wp_customize->add_setting(
'ocean_footer_copyright_text',
array(
'transport' => 'postMessage',
'default' => 'Copyright [oceanwp_date] - OceanWP Theme by Nick',
'sanitize_callback' => 'wp_kses_post',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Textarea_Control(
$wp_customize,
'ocean_footer_copyright_text',
array(
'label' => esc_html__( 'Copyright', 'oceanwp' ),
/* translators: 1: shortocde doc link 2: </a> */
'description' => sprintf( esc_html__( 'Shortcodes allowed, %1$ssee the list%2$s.', 'oceanwp' ), '<a href="http://docs.oceanwp.org/category/369-shortcodes" target="_blank">', '</a>' ),
'section' => $section,
'settings' => 'ocean_footer_copyright_text',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_footer_bottom',
)
)
);
/**
* Footer Bottom Padding
*/
$wp_customize->add_setting(
'ocean_bottom_footer_top_padding',
array(
'transport' => 'postMessage',
'default' => '15',
'sanitize_callback' => 'oceanwp_sanitize_number',
)
);
$wp_customize->add_setting(
'ocean_bottom_footer_right_padding',
array(
'transport' => 'postMessage',
'default' => '0',
'sanitize_callback' => 'oceanwp_sanitize_number',
)
);
$wp_customize->add_setting(
'ocean_bottom_footer_bottom_padding',
array(
'transport' => 'postMessage',
'default' => '15',
'sanitize_callback' => 'oceanwp_sanitize_number',
)
);
$wp_customize->add_setting(
'ocean_bottom_footer_left_padding',
array(
'transport' => 'postMessage',
'default' => '0',
'sanitize_callback' => 'oceanwp_sanitize_number',
)
);
$wp_customize->add_setting(
'ocean_bottom_footer_tablet_top_padding',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
)
);
$wp_customize->add_setting(
'ocean_bottom_footer_tablet_right_padding',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
)
);
$wp_customize->add_setting(
'ocean_bottom_footer_tablet_bottom_padding',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
)
);
$wp_customize->add_setting(
'ocean_bottom_footer_tablet_left_padding',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
)
);
$wp_customize->add_setting(
'ocean_bottom_footer_mobile_top_padding',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
)
);
$wp_customize->add_setting(
'ocean_bottom_footer_mobile_right_padding',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
)
);
$wp_customize->add_setting(
'ocean_bottom_footer_mobile_bottom_padding',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
)
);
$wp_customize->add_setting(
'ocean_bottom_footer_mobile_left_padding',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Dimensions_Control(
$wp_customize,
'ocean_bottom_footer_padding_dimensions',
array(
'label' => esc_html__( 'Padding (px)', 'oceanwp' ),
'section' => $section,
'settings' => array(
'desktop_top' => 'ocean_bottom_footer_top_padding',
'desktop_right' => 'ocean_bottom_footer_right_padding',
'desktop_bottom' => 'ocean_bottom_footer_bottom_padding',
'desktop_left' => 'ocean_bottom_footer_left_padding',
'tablet_top' => 'ocean_bottom_footer_tablet_top_padding',
'tablet_right' => 'ocean_bottom_footer_tablet_right_padding',
'tablet_bottom' => 'ocean_bottom_footer_tablet_bottom_padding',
'tablet_left' => 'ocean_bottom_footer_tablet_left_padding',
'mobile_top' => 'ocean_bottom_footer_mobile_top_padding',
'mobile_right' => 'ocean_bottom_footer_mobile_right_padding',
'mobile_bottom' => 'ocean_bottom_footer_mobile_bottom_padding',
'mobile_left' => 'ocean_bottom_footer_mobile_left_padding',
),
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_footer_bottom',
'input_attrs' => array(
'min' => 0,
'max' => 500,
'step' => 1,
),
)
)
);
/**
* Footer Bottom Background Color
*/
$wp_customize->add_setting(
'ocean_bottom_footer_background',
array(
'transport' => 'postMessage',
'default' => '#1b1b1b',
'sanitize_callback' => 'oceanwp_sanitize_color',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Color_Control(
$wp_customize,
'ocean_bottom_footer_background',
array(
'label' => esc_html__( 'Background Color', 'oceanwp' ),
'section' => $section,
'settings' => 'ocean_bottom_footer_background',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_footer_bottom',
)
)
);
/**
* Footer Bottom Color
*/
$wp_customize->add_setting(
'ocean_bottom_footer_color',
array(
'transport' => 'postMessage',
'default' => '#929292',
'sanitize_callback' => 'oceanwp_sanitize_color',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Color_Control(
$wp_customize,
'ocean_bottom_footer_color',
array(
'label' => esc_html__( 'Text Color', 'oceanwp' ),
'section' => $section,
'settings' => 'ocean_bottom_footer_color',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_footer_bottom',
)
)
);
/**
* Footer Bottom Links Color
*/
$wp_customize->add_setting(
'ocean_bottom_footer_link_color',
array(
'transport' => 'postMessage',
'default' => '#ffffff',
'sanitize_callback' => 'oceanwp_sanitize_color',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Color_Control(
$wp_customize,
'ocean_bottom_footer_link_color',
array(
'label' => esc_html__( 'Links Color', 'oceanwp' ),
'section' => $section,
'settings' => 'ocean_bottom_footer_link_color',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_footer_bottom',
)
)
);
/**
* Footer Bottom Links Hover Color
*/
$wp_customize->add_setting(
'ocean_bottom_footer_link_color_hover',
array(
'transport' => 'postMessage',
'default' => '#13aff0',
'sanitize_callback' => 'oceanwp_sanitize_color',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Color_Control(
$wp_customize,
'ocean_bottom_footer_link_color_hover',
array(
'label' => esc_html__( 'Links Color: Hover', 'oceanwp' ),
'section' => $section,
'settings' => 'ocean_bottom_footer_link_color_hover',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_footer_bottom',
)
)
);
}
/**
* Get CSS
*
* @param obj $output css output.
* @since 1.0.0
*/
public static function head_css( $output ) {
// Global vars.
$bottom_top_padding = get_theme_mod( 'ocean_bottom_footer_top_padding', '15' );
$bottom_right_padding = get_theme_mod( 'ocean_bottom_footer_right_padding', '0' );
$bottom_bottom_padding = get_theme_mod( 'ocean_bottom_footer_bottom_padding', '15' );
$bottom_left_padding = get_theme_mod( 'ocean_bottom_footer_left_padding', '0' );
$tablet_top_padding = get_theme_mod( 'ocean_bottom_footer_tablet_top_padding' );
$tablet_right_padding = get_theme_mod( 'ocean_bottom_footer_tablet_right_padding' );
$tablet_bottom_padding = get_theme_mod( 'ocean_bottom_footer_tablet_bottom_padding' );
$tablet_left_padding = get_theme_mod( 'ocean_bottom_footer_tablet_left_padding' );
$mobile_top_padding = get_theme_mod( 'ocean_bottom_footer_mobile_top_padding' );
$mobile_right_padding = get_theme_mod( 'ocean_bottom_footer_mobile_right_padding' );
$mobile_bottom_padding = get_theme_mod( 'ocean_bottom_footer_mobile_bottom_padding' );
$mobile_left_padding = get_theme_mod( 'ocean_bottom_footer_mobile_left_padding' );
$bottom_background = get_theme_mod( 'ocean_bottom_footer_background', '#1b1b1b' );
$bottom_color = get_theme_mod( 'ocean_bottom_footer_color', '#929292' );
$bottom_link_color = get_theme_mod( 'ocean_bottom_footer_link_color', '#ffffff' );
$bottom_link_color_hover = get_theme_mod( 'ocean_bottom_footer_link_color_hover', '#13aff0' );
// Define css var.
$css = '';
// Footer bottom padding.
if ( isset( $bottom_top_padding ) && '15' != $bottom_top_padding && '' != $bottom_top_padding
|| isset( $bottom_right_padding ) && '0' != $bottom_right_padding && '' != $bottom_right_padding
|| isset( $bottom_bottom_padding ) && '15' != $bottom_bottom_padding && '' != $bottom_bottom_padding
|| isset( $bottom_left_padding ) && '0' != $bottom_left_padding && '' != $bottom_left_padding ) {
$css .= '#footer-bottom{padding:' . oceanwp_spacing_css( $bottom_top_padding, $bottom_right_padding, $bottom_bottom_padding, $bottom_left_padding ) . '}';
}
// Tablet footer bottom padding.
if ( isset( $tablet_top_padding ) && '' != $tablet_top_padding
|| isset( $tablet_right_padding ) && '' != $tablet_right_padding
|| isset( $tablet_bottom_padding ) && '' != $tablet_bottom_padding
|| isset( $tablet_left_padding ) && '' != $tablet_left_padding ) {
$css .= '@media (max-width: 768px){#footer-bottom{padding:' . oceanwp_spacing_css( $tablet_top_padding, $tablet_right_padding, $tablet_bottom_padding, $tablet_left_padding ) . '}}';
}
// Mobile footer bottom padding.
if ( isset( $mobile_top_padding ) && '' != $mobile_top_padding
|| isset( $mobile_right_padding ) && '' != $mobile_right_padding
|| isset( $mobile_bottom_padding ) && '' != $mobile_bottom_padding
|| isset( $mobile_left_padding ) && '' != $mobile_left_padding ) {
$css .= '@media (max-width: 480px){#footer-bottom{padding:' . oceanwp_spacing_css( $mobile_top_padding, $mobile_right_padding, $mobile_bottom_padding, $mobile_left_padding ) . '}}';
}
// Footer bottom background.
if ( ! empty( $bottom_background ) && '#1b1b1b' != $bottom_background ) {
$css .= '#footer-bottom{background-color:' . $bottom_background . ';}';
}
// Footer bottom color.
if ( ! empty( $bottom_color ) && '#929292' != $bottom_color ) {
$css .= '#footer-bottom,#footer-bottom p{color:' . $bottom_color . ';}';
}
// Footer bottom links color.
if ( ! empty( $bottom_link_color ) && '#ffffff' != $bottom_link_color ) {
$css .= '#footer-bottom a,#footer-bottom #footer-bottom-menu a{color:' . $bottom_link_color . ';}';
}
// Footer bottom links hover color.
if ( ! empty( $bottom_link_color_hover ) && '#13aff0' != $bottom_link_color_hover ) {
$css .= '#footer-bottom a:hover,#footer-bottom #footer-bottom-menu a:hover{color:' . $bottom_link_color_hover . ';}';
}
// Return CSS.
if ( ! empty( $css ) ) {
$output .= '/* Footer Bottom CSS */' . $css;
}
// Return output css.
return $output;
}
}
endif;
return new OceanWP_Footer_Bottom_Customizer();
@@ -0,0 +1,625 @@
<?php
/**
* Footer Widgets Customizer Options
*
* @package OceanWP WordPress theme
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'OceanWP_Footer_Widgets_Customizer' ) ) :
/**
* Settings for footer widgets
*/
class OceanWP_Footer_Widgets_Customizer {
/**
* Setup class.
*
* @since 1.0
*/
public function __construct() {
add_action( 'customize_register', array( $this, 'customizer_options' ) );
add_filter( 'ocean_head_css', array( $this, 'head_css' ) );
}
/**
* Customizer options
*
* @param WP_Customize_Manager $wp_customize Reference to WP_Customize_Manager.
* @since 1.0.0
*/
public function customizer_options( $wp_customize ) {
/**
* Section
*/
$section = 'ocean_footer_widgets_section';
$wp_customize->add_section(
$section,
array(
'title' => esc_html__( 'Footer Widgets', 'oceanwp' ),
'priority' => 210,
)
);
/**
* Enable Footer Widgets
*/
$wp_customize->add_setting(
'ocean_footer_widgets',
array(
'default' => true,
'sanitize_callback' => 'oceanwp_sanitize_checkbox',
)
);
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'ocean_footer_widgets',
array(
'label' => esc_html__( 'Enable Footer Widgets', 'oceanwp' ),
'type' => 'checkbox',
'section' => $section,
'settings' => 'ocean_footer_widgets',
'priority' => 10,
)
)
);
/**
* Footer Widgets Visibility
*/
$wp_customize->add_setting(
'ocean_footer_widgets_visibility',
array(
'transport' => 'postMessage',
'default' => 'all-devices',
'sanitize_callback' => 'oceanwp_sanitize_select',
)
);
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'ocean_footer_widgets_visibility',
array(
'label' => esc_html__( 'Visibility', 'oceanwp' ),
'type' => 'select',
'section' => $section,
'settings' => 'ocean_footer_widgets_visibility',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_footer_widgets',
'choices' => array(
'all-devices' => esc_html__( 'Show On All Devices', 'oceanwp' ),
'hide-tablet' => esc_html__( 'Hide On Tablet', 'oceanwp' ),
'hide-mobile' => esc_html__( 'Hide On Mobile', 'oceanwp' ),
'hide-tablet-mobile' => esc_html__( 'Hide On Tablet & Mobile', 'oceanwp' ),
),
)
)
);
/**
* Fixed Footer
*/
$wp_customize->add_setting(
'ocean_fixed_footer',
array(
'default' => 'off',
'sanitize_callback' => 'oceanwp_sanitize_select',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Buttonset_Control(
$wp_customize,
'ocean_fixed_footer',
array(
'label' => esc_html__( 'Fixed Footer', 'oceanwp' ),
'description' => esc_html__( 'This option add a height to your content to keep your footer at the bottom of your page.', 'oceanwp' ),
'section' => $section,
'settings' => 'ocean_fixed_footer',
'priority' => 10,
'choices' => array(
'on' => esc_html__( 'On', 'oceanwp' ),
'off' => esc_html__( 'Off', 'oceanwp' ),
),
'active_callback' => 'oceanwp_cac_has_footer_widgets',
)
)
);
/**
* Parallax Footer Effect
*/
$wp_customize->add_setting(
'ocean_parallax_footer',
array(
'default' => 'off',
'sanitize_callback' => 'oceanwp_sanitize_select',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Buttonset_Control(
$wp_customize,
'ocean_parallax_footer',
array(
'label' => esc_html__( 'Parallax Footer Effect', 'oceanwp' ),
'description' => esc_html__( 'Add a parallax effect to your footer.', 'oceanwp' ),
'section' => $section,
'settings' => 'ocean_parallax_footer',
'priority' => 10,
'choices' => array(
'on' => esc_html__( 'On', 'oceanwp' ),
'off' => esc_html__( 'Off', 'oceanwp' ),
),
'active_callback' => 'oceanwp_cac_has_footer_widgets',
)
)
);
/**
* Footer Widgets Template
*/
$wp_customize->add_setting(
'ocean_footer_widgets_template',
array(
'default' => '0',
'sanitize_callback' => 'oceanwp_sanitize_select',
)
);
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'ocean_footer_widgets_template',
array(
'label' => esc_html__( 'Select Template', 'oceanwp' ),
'description' => esc_html__( 'Choose a template created in Theme Panel > My Library.', 'oceanwp' ),
'type' => 'select',
'section' => $section,
'settings' => 'ocean_footer_widgets_template',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_footer_widgets',
'choices' => oceanwp_customizer_helpers( 'library' ),
)
)
);
/**
* Footer Widgets Columns
*/
$wp_customize->add_setting(
'ocean_footer_widgets_columns',
array(
'default' => '4',
'sanitize_callback' => 'oceanwp_sanitize_number',
)
);
$wp_customize->add_setting(
'ocean_footer_widgets_tablet_columns',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
)
);
$wp_customize->add_setting(
'ocean_footer_widgets_mobile_columns',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Slider_Control(
$wp_customize,
'ocean_footer_widgets_columns',
array(
'label' => esc_html__( 'Columns', 'oceanwp' ),
'section' => $section,
'settings' => array(
'desktop' => 'ocean_footer_widgets_columns',
'tablet' => 'ocean_footer_widgets_tablet_columns',
'mobile' => 'ocean_footer_widgets_mobile_columns',
),
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_footer_widgets_and_no_page_id',
'input_attrs' => array(
'min' => 1,
'max' => 4,
'step' => 1,
),
)
)
);
/**
* Footer Widgets Add Container
*/
$wp_customize->add_setting(
'ocean_add_footer_container',
array(
'transport' => 'postMessage',
'default' => true,
'sanitize_callback' => 'oceanwp_sanitize_checkbox',
)
);
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'ocean_add_footer_container',
array(
'label' => esc_html__( 'Add Container', 'oceanwp' ),
'type' => 'checkbox',
'section' => $section,
'settings' => 'ocean_add_footer_container',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_footer_widgets',
)
)
);
/**
* Footer Widgets Padding
*/
$wp_customize->add_setting(
'ocean_footer_top_padding',
array(
'transport' => 'postMessage',
'default' => '30',
'sanitize_callback' => 'oceanwp_sanitize_number',
)
);
$wp_customize->add_setting(
'ocean_footer_right_padding',
array(
'transport' => 'postMessage',
'default' => '0',
'sanitize_callback' => 'oceanwp_sanitize_number',
)
);
$wp_customize->add_setting(
'ocean_footer_bottom_padding',
array(
'transport' => 'postMessage',
'default' => '30',
'sanitize_callback' => 'oceanwp_sanitize_number',
)
);
$wp_customize->add_setting(
'ocean_footer_left_padding',
array(
'transport' => 'postMessage',
'default' => '0',
'sanitize_callback' => 'oceanwp_sanitize_number',
)
);
$wp_customize->add_setting(
'ocean_footer_tablet_top_padding',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
)
);
$wp_customize->add_setting(
'ocean_footer_tablet_right_padding',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
)
);
$wp_customize->add_setting(
'ocean_footer_tablet_bottom_padding',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
)
);
$wp_customize->add_setting(
'ocean_footer_tablet_left_padding',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
)
);
$wp_customize->add_setting(
'ocean_footer_mobile_top_padding',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
)
);
$wp_customize->add_setting(
'ocean_footer_mobile_right_padding',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
)
);
$wp_customize->add_setting(
'ocean_footer_mobile_bottom_padding',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
)
);
$wp_customize->add_setting(
'ocean_footer_mobile_left_padding',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Dimensions_Control(
$wp_customize,
'ocean_footer_padding_dimensions',
array(
'label' => esc_html__( 'Padding (px)', 'oceanwp' ),
'section' => $section,
'settings' => array(
'desktop_top' => 'ocean_footer_top_padding',
'desktop_right' => 'ocean_footer_right_padding',
'desktop_bottom' => 'ocean_footer_bottom_padding',
'desktop_left' => 'ocean_footer_left_padding',
'tablet_top' => 'ocean_footer_tablet_top_padding',
'tablet_right' => 'ocean_footer_tablet_right_padding',
'tablet_bottom' => 'ocean_footer_tablet_bottom_padding',
'tablet_left' => 'ocean_footer_tablet_left_padding',
'mobile_top' => 'ocean_footer_mobile_top_padding',
'mobile_right' => 'ocean_footer_mobile_right_padding',
'mobile_bottom' => 'ocean_footer_mobile_bottom_padding',
'mobile_left' => 'ocean_footer_mobile_left_padding',
),
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_footer_widgets',
'input_attrs' => array(
'min' => 0,
'max' => 500,
'step' => 1,
),
)
)
);
/**
* Footer Widgets Background
*/
$wp_customize->add_setting(
'ocean_footer_background',
array(
'transport' => 'postMessage',
'default' => '#222222',
'sanitize_callback' => 'oceanwp_sanitize_color',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Color_Control(
$wp_customize,
'ocean_footer_background',
array(
'label' => esc_html__( 'Background Color', 'oceanwp' ),
'section' => $section,
'settings' => 'ocean_footer_background',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_footer_widgets',
)
)
);
/**
* Footer Widgets Color
*/
$wp_customize->add_setting(
'ocean_footer_color',
array(
'transport' => 'postMessage',
'default' => '#929292',
'sanitize_callback' => 'oceanwp_sanitize_color',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Color_Control(
$wp_customize,
'ocean_footer_color',
array(
'label' => esc_html__( 'Text Color', 'oceanwp' ),
'section' => $section,
'settings' => 'ocean_footer_color',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_footer_widgets',
)
)
);
/**
* Footer Widgets Borders Color
*/
$wp_customize->add_setting(
'ocean_footer_borders',
array(
'transport' => 'postMessage',
'default' => '#555555',
'sanitize_callback' => 'oceanwp_sanitize_color',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Color_Control(
$wp_customize,
'ocean_footer_borders',
array(
'label' => esc_html__( 'Borders Color', 'oceanwp' ),
'section' => $section,
'settings' => 'ocean_footer_borders',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_footer_widgets',
)
)
);
/**
* Footer Widgets Links Color
*/
$wp_customize->add_setting(
'ocean_footer_link_color',
array(
'transport' => 'postMessage',
'default' => '#ffffff',
'sanitize_callback' => 'oceanwp_sanitize_color',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Color_Control(
$wp_customize,
'ocean_footer_link_color',
array(
'label' => esc_html__( 'Links Color', 'oceanwp' ),
'section' => $section,
'settings' => 'ocean_footer_link_color',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_footer_widgets',
)
)
);
/**
* Footer Widgets Links Hover Color
*/
$wp_customize->add_setting(
'ocean_footer_link_color_hover',
array(
'transport' => 'postMessage',
'default' => '#13aff0',
'sanitize_callback' => 'oceanwp_sanitize_color',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Color_Control(
$wp_customize,
'ocean_footer_link_color_hover',
array(
'label' => esc_html__( 'Links Color: Hover', 'oceanwp' ),
'section' => $section,
'settings' => 'ocean_footer_link_color_hover',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_footer_widgets',
)
)
);
}
/**
* Get CSS
*
* @param obj $output css output.
* @since 1.0.0
*/
public static function head_css( $output ) {
// Global vars.
$footer_top_padding = get_theme_mod( 'ocean_footer_top_padding', '30' );
$footer_right_padding = get_theme_mod( 'ocean_footer_right_padding', '0' );
$footer_bottom_padding = get_theme_mod( 'ocean_footer_bottom_padding', '30' );
$footer_left_padding = get_theme_mod( 'ocean_footer_left_padding', '0' );
$tablet_footer_top_padding = get_theme_mod( 'ocean_footer_tablet_top_padding' );
$tablet_footer_right_padding = get_theme_mod( 'ocean_footer_tablet_right_padding' );
$tablet_footer_bottom_padding = get_theme_mod( 'ocean_footer_tablet_bottom_padding' );
$tablet_footer_left_padding = get_theme_mod( 'ocean_footer_tablet_left_padding' );
$mobile_footer_top_padding = get_theme_mod( 'ocean_footer_mobile_top_padding' );
$mobile_footer_right_padding = get_theme_mod( 'ocean_footer_mobile_right_padding' );
$mobile_footer_bottom_padding = get_theme_mod( 'ocean_footer_mobile_bottom_padding' );
$mobile_footer_left_padding = get_theme_mod( 'ocean_footer_mobile_left_padding' );
$footer_background = get_theme_mod( 'ocean_footer_background', '#222222' );
$footer_color = get_theme_mod( 'ocean_footer_color', '#929292' );
$footer_borders = get_theme_mod( 'ocean_footer_borders', '#555555' );
$footer_link_color = get_theme_mod( 'ocean_footer_link_color', '#ffffff' );
$footer_link_color_hover = get_theme_mod( 'ocean_footer_link_color_hover', '#13aff0' );
// Define css var.
$css = '';
// Footer padding.
if ( isset( $footer_top_padding ) && '30' != $footer_top_padding && '' != $footer_top_padding
|| isset( $footer_right_padding ) && '0' != $footer_right_padding && '' != $footer_right_padding
|| isset( $footer_bottom_padding ) && '30' != $footer_bottom_padding && '' != $footer_bottom_padding
|| isset( $footer_left_padding ) && '0' != $footer_left_padding && '' != $footer_left_padding ) {
$css .= '#footer-widgets{padding:' . oceanwp_spacing_css( $footer_top_padding, $footer_right_padding, $footer_bottom_padding, $footer_left_padding ) . '}';
}
// Tablet footer padding.
if ( isset( $tablet_footer_top_padding ) && '' != $tablet_footer_top_padding
|| isset( $tablet_footer_right_padding ) && '' != $tablet_footer_right_padding
|| isset( $tablet_footer_bottom_padding ) && '' != $tablet_footer_bottom_padding
|| isset( $tablet_footer_left_padding ) && '' != $tablet_footer_left_padding ) {
$css .= '@media (max-width: 768px){#footer-widgets{padding:' . oceanwp_spacing_css( $tablet_footer_top_padding, $tablet_footer_right_padding, $tablet_footer_bottom_padding, $tablet_footer_left_padding ) . '}}';
}
// Mobile footer padding.
if ( isset( $mobile_footer_top_padding ) && '' != $mobile_footer_top_padding
|| isset( $mobile_footer_right_padding ) && '' != $mobile_footer_right_padding
|| isset( $mobile_footer_bottom_padding ) && '' != $mobile_footer_bottom_padding
|| isset( $mobile_footer_left_padding ) && '' != $mobile_footer_left_padding ) {
$css .= '@media (max-width: 480px){#footer-widgets{padding:' . oceanwp_spacing_css( $mobile_footer_top_padding, $mobile_footer_right_padding, $mobile_footer_bottom_padding, $mobile_footer_left_padding ) . '}}';
}
// Footer background.
if ( ! empty( $footer_background ) && '#222222' != $footer_background ) {
$css .= '#footer-widgets{background-color:' . $footer_background . ';}';
}
// Footer color.
if ( ! empty( $footer_color ) && '#929292' != $footer_color ) {
$css .= '#footer-widgets,#footer-widgets p,#footer-widgets li a:before,#footer-widgets .contact-info-widget span.oceanwp-contact-title,#footer-widgets .recent-posts-date,#footer-widgets .recent-posts-comments,#footer-widgets .widget-recent-posts-icons li .fa{color:' . $footer_color . ';}';
}
// Footer borders color.
if ( ! empty( $footer_borders ) && '#555555' != $footer_borders ) {
$css .= '#footer-widgets li,#footer-widgets #wp-calendar caption,#footer-widgets #wp-calendar th,#footer-widgets #wp-calendar tbody,#footer-widgets .contact-info-widget i,#footer-widgets .oceanwp-newsletter-form-wrap input[type="email"],#footer-widgets .posts-thumbnails-widget li,#footer-widgets .social-widget li a{border-color:' . $footer_borders . ';}';
}
// Footer link color.
if ( ! empty( $footer_link_color ) && '#ffffff' != $footer_link_color ) {
$css .= '#footer-widgets .footer-box a,#footer-widgets a{color:' . $footer_link_color . ';}';
}
// Footer link hover color.
if ( ! empty( $footer_link_color_hover ) && '#13aff0' != $footer_link_color_hover ) {
$css .= '#footer-widgets .footer-box a:hover,#footer-widgets a:hover{color:' . $footer_link_color_hover . ';}';
}
// Return CSS.
if ( ! empty( $css ) ) {
$output .= '/* Footer Widgets CSS */' . $css;
}
// Return output css.
return $output;
}
}
endif;
return new OceanWP_Footer_Widgets_Customizer();
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,998 @@
<?php
/**
* LearnDash Customizer Options
*
* @package OceanWP WordPress theme
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'OceanWP_LearnDash_Customizer' ) ) :
/**
* Settings for general options
*/
class OceanWP_LearnDash_Customizer {
/**
* Setup class.
*
* @since 1.0
*/
public function __construct() {
add_action( 'customize_register', array( $this, 'customizer_options' ) );
add_filter( 'ocean_head_css', array( $this, 'head_css' ) );
}
/**
* Customizer options
*
* @param WP_Customize_Manager $wp_customize Reference to WP_Customize_Manager.
* @since 1.0.0
*/
public function customizer_options( $wp_customize ) {
/**
* Panel
*/
$panel = 'ocean_ld_panel';
$wp_customize->add_panel(
$panel,
array(
'title' => esc_html__( 'LearnDash', 'oceanwp' ),
'priority' => 210,
)
);
/**
* Section
*/
$wp_customize->add_section(
'ocean_ld_general',
array(
'title' => esc_html__( 'General', 'oceanwp' ),
'description' => esc_html__( 'For some options, you must save and refresh your live site to preview changes.', 'oceanwp' ),
'priority' => 10,
'panel' => $panel,
)
);
/**
* General Header
*/
$wp_customize->add_setting(
'ocean_ld_general_heading',
array(
'sanitize_callback' => 'wp_kses',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Heading_Control(
$wp_customize,
'ocean_ld_general_heading',
array(
'label' => esc_html__( 'General', 'oceanwp' ),
'section' => 'ocean_ld_general',
'priority' => 10,
)
)
);
/**
* Distraction Free Learning
*/
$wp_customize->add_setting(
'ocean_ld_distraction_free_learning',
array(
'default' => false,
'sanitize_callback' => 'oceanwp_sanitize_checkbox',
)
);
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'ocean_ld_distraction_free_learning',
array(
'label' => esc_html__( 'Distraction Free Learning', 'oceanwp' ),
'type' => 'checkbox',
'section' => 'ocean_ld_general',
'settings' => 'ocean_ld_distraction_free_learning',
'priority' => 10,
)
)
);
/**
* Section
*/
$wp_customize->add_section(
'ocean_ld_layout',
array(
'title' => esc_html__( 'Layout', 'oceanwp' ),
'description' => esc_html__( 'For some options, you must save and refresh your live site to preview changes.', 'oceanwp' ),
'priority' => 10,
'panel' => $panel,
)
);
/**
* Global Layout Header
*/
$wp_customize->add_setting(
'ocean_ld_global_heading',
array(
'sanitize_callback' => 'wp_kses',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Heading_Control(
$wp_customize,
'ocean_ld_global_heading',
array(
'label' => esc_html__( 'Global', 'oceanwp' ),
'section' => 'ocean_ld_layout',
'priority' => 10,
)
)
);
/**
* Layout
*/
$wp_customize->add_setting(
'ocean_ld_global_layout',
array(
'default' => 'full-width',
'sanitize_callback' => 'oceanwp_sanitize_select',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Radio_Image_Control(
$wp_customize,
'ocean_ld_global_layout',
array(
'label' => esc_html__( 'Layout', 'oceanwp' ),
'section' => 'ocean_ld_layout',
'settings' => 'ocean_ld_global_layout',
'priority' => 10,
'choices' => oceanwp_customizer_layout(),
)
)
);
/**
* Both Sidebars Style
*/
$wp_customize->add_setting(
'ocean_ld_global_both_sidebars_style',
array(
'default' => 'scs-style',
'sanitize_callback' => 'oceanwp_sanitize_select',
)
);
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'ocean_ld_global_both_sidebars_style',
array(
'label' => esc_html__( 'Both Sidebars: Style', 'oceanwp' ),
'type' => 'select',
'section' => 'ocean_ld_layout',
'settings' => 'ocean_ld_global_both_sidebars_style',
'priority' => 10,
'choices' => array(
'ssc-style' => esc_html__( 'Sidebar / Sidebar / Content', 'oceanwp' ),
'scs-style' => esc_html__( 'Sidebar / Content / Sidebar', 'oceanwp' ),
'css-style' => esc_html__( 'Content / Sidebar / Sidebar', 'oceanwp' ),
),
'active_callback' => 'oceanwp_cac_has_ld_global_bs_layout',
)
)
);
/**
* Both Sidebars Content Width
*/
$wp_customize->add_setting(
'ocean_ld_global_both_sidebars_content_width',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
)
);
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'ocean_ld_global_both_sidebars_content_width',
array(
'label' => esc_html__( 'Both Sidebars: Content Width (%)', 'oceanwp' ),
'type' => 'number',
'section' => 'ocean_ld_layout',
'settings' => 'ocean_ld_global_both_sidebars_content_width',
'priority' => 10,
'input_attrs' => array(
'min' => 0,
'max' => 100,
'step' => 1,
),
'active_callback' => 'oceanwp_cac_has_ld_global_bs_layout',
)
)
);
/**
* Both Sidebars Sidebars Width
*/
$wp_customize->add_setting(
'ocean_ld_global_both_sidebars_sidebars_width',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
)
);
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'ocean_ld_global_both_sidebars_sidebars_width',
array(
'label' => esc_html__( 'Both Sidebars: Sidebars Width (%)', 'oceanwp' ),
'type' => 'number',
'section' => 'ocean_ld_layout',
'settings' => 'ocean_ld_global_both_sidebars_sidebars_width',
'priority' => 10,
'input_attrs' => array(
'min' => 0,
'max' => 100,
'step' => 1,
),
'active_callback' => 'oceanwp_cac_has_ld_global_bs_layout',
)
)
);
/**
* Mobile Sidebar Order
*/
$wp_customize->add_setting(
'ocean_ld_global_sidebar_order',
array(
'default' => 'content-sidebar',
'sanitize_callback' => 'oceanwp_sanitize_select',
)
);
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'ocean_ld_global_sidebar_order',
array(
'label' => esc_html__( 'Mobile Sidebar Order', 'oceanwp' ),
'type' => 'select',
'section' => 'ocean_ld_layout',
'settings' => 'ocean_ld_global_sidebar_order',
'priority' => 10,
'choices' => array(
'content-sidebar' => esc_html__( 'Content / Sidebar', 'oceanwp' ),
'sidebar-content' => esc_html__( 'Sidebar / Content', 'oceanwp' ),
),
'active_callback' => 'oceanwp_cac_has_ld_global_rl_layout',
)
)
);
/**
* Course Page Header
*/
$wp_customize->add_setting(
'ocean_ld_course_heading',
array(
'sanitize_callback' => 'wp_kses',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Heading_Control(
$wp_customize,
'ocean_ld_course_heading',
array(
'label' => esc_html__( 'Course', 'oceanwp' ),
'section' => 'ocean_ld_layout',
'priority' => 10,
)
)
);
/**
* Layout
*/
$wp_customize->add_setting(
'ocean_ld_course_layout',
array(
'default' => 'left-sidebar',
'sanitize_callback' => 'oceanwp_sanitize_select',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Radio_Image_Control(
$wp_customize,
'ocean_ld_course_layout',
array(
'label' => esc_html__( 'Layout', 'oceanwp' ),
'section' => 'ocean_ld_layout',
'settings' => 'ocean_ld_course_layout',
'priority' => 10,
'choices' => oceanwp_customizer_layout(),
)
)
);
/**
* Both Sidebars Style
*/
$wp_customize->add_setting(
'ocean_ld_course_both_sidebars_style',
array(
'default' => 'scs-style',
'sanitize_callback' => 'oceanwp_sanitize_select',
)
);
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'ocean_ld_course_both_sidebars_style',
array(
'label' => esc_html__( 'Both Sidebars: Style', 'oceanwp' ),
'type' => 'select',
'section' => 'ocean_ld_layout',
'settings' => 'ocean_ld_course_both_sidebars_style',
'priority' => 10,
'choices' => array(
'ssc-style' => esc_html__( 'Sidebar / Sidebar / Content', 'oceanwp' ),
'scs-style' => esc_html__( 'Sidebar / Content / Sidebar', 'oceanwp' ),
'css-style' => esc_html__( 'Content / Sidebar / Sidebar', 'oceanwp' ),
),
'active_callback' => 'oceanwp_cac_has_ld_course_bs_layout',
)
)
);
/**
* Both Sidebars Content Width
*/
$wp_customize->add_setting(
'ocean_ld_course_both_sidebars_content_width',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
)
);
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'ocean_ld_course_both_sidebars_content_width',
array(
'label' => esc_html__( 'Both Sidebars: Content Width (%)', 'oceanwp' ),
'type' => 'number',
'section' => 'ocean_ld_layout',
'settings' => 'ocean_ld_course_both_sidebars_content_width',
'priority' => 10,
'input_attrs' => array(
'min' => 0,
'max' => 100,
'step' => 1,
),
'active_callback' => 'oceanwp_cac_has_ld_course_bs_layout',
)
)
);
/**
* Both Sidebars Sidebars Width
*/
$wp_customize->add_setting(
'ocean_ld_course_both_sidebars_sidebars_width',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
)
);
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'ocean_ld_course_both_sidebars_sidebars_width',
array(
'label' => esc_html__( 'Both Sidebars: Sidebars Width (%)', 'oceanwp' ),
'type' => 'number',
'section' => 'ocean_ld_layout',
'settings' => 'ocean_ld_course_both_sidebars_sidebars_width',
'priority' => 10,
'input_attrs' => array(
'min' => 0,
'max' => 100,
'step' => 1,
),
'active_callback' => 'oceanwp_cac_has_ld_course_bs_layout',
)
)
);
/**
* Mobile Sidebar Order
*/
$wp_customize->add_setting(
'ocean_ld_course_sidebar_order',
array(
'default' => 'content-sidebar',
'sanitize_callback' => 'oceanwp_sanitize_select',
)
);
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'ocean_ld_course_sidebar_order',
array(
'label' => esc_html__( 'Mobile Sidebar Order', 'oceanwp' ),
'type' => 'select',
'section' => 'ocean_ld_layout',
'settings' => 'ocean_ld_course_sidebar_order',
'priority' => 10,
'choices' => array(
'content-sidebar' => esc_html__( 'Content / Sidebar', 'oceanwp' ),
'sidebar-content' => esc_html__( 'Sidebar / Content', 'oceanwp' ),
),
'active_callback' => 'oceanwp_cac_has_ld_course_rl_layout',
)
)
);
/**
* Lesson Page Header
*/
$wp_customize->add_setting(
'ocean_ld_lesson_heading',
array(
'sanitize_callback' => 'wp_kses',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Heading_Control(
$wp_customize,
'ocean_ld_lesson_heading',
array(
'label' => esc_html__( 'Lesson/Topic', 'oceanwp' ),
'section' => 'ocean_ld_layout',
'priority' => 10,
)
)
);
/**
* Layout
*/
$wp_customize->add_setting(
'ocean_ld_lesson_layout',
array(
'default' => 'left-sidebar',
'sanitize_callback' => 'oceanwp_sanitize_select',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Radio_Image_Control(
$wp_customize,
'ocean_ld_lesson_layout',
array(
'label' => esc_html__( 'Layout', 'oceanwp' ),
'section' => 'ocean_ld_layout',
'settings' => 'ocean_ld_lesson_layout',
'priority' => 10,
'choices' => oceanwp_customizer_layout(),
)
)
);
/**
* Both Sidebars Style
*/
$wp_customize->add_setting(
'ocean_ld_lesson_both_sidebars_style',
array(
'default' => 'scs-style',
'sanitize_callback' => 'oceanwp_sanitize_select',
)
);
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'ocean_ld_lesson_both_sidebars_style',
array(
'label' => esc_html__( 'Both Sidebars: Style', 'oceanwp' ),
'type' => 'select',
'section' => 'ocean_ld_layout',
'settings' => 'ocean_ld_lesson_both_sidebars_style',
'priority' => 10,
'choices' => array(
'ssc-style' => esc_html__( 'Sidebar / Sidebar / Content', 'oceanwp' ),
'scs-style' => esc_html__( 'Sidebar / Content / Sidebar', 'oceanwp' ),
'css-style' => esc_html__( 'Content / Sidebar / Sidebar', 'oceanwp' ),
),
'active_callback' => 'oceanwp_cac_has_ld_lesson_bs_layout',
)
)
);
/**
* Both Sidebars Content Width
*/
$wp_customize->add_setting(
'ocean_ld_lesson_both_sidebars_content_width',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
)
);
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'ocean_ld_lesson_both_sidebars_content_width',
array(
'label' => esc_html__( 'Both Sidebars: Content Width (%)', 'oceanwp' ),
'type' => 'number',
'section' => 'ocean_ld_layout',
'settings' => 'ocean_ld_lesson_both_sidebars_content_width',
'priority' => 10,
'input_attrs' => array(
'min' => 0,
'max' => 100,
'step' => 1,
),
'active_callback' => 'oceanwp_cac_has_ld_lesson_bs_layout',
)
)
);
/**
* Both Sidebars Sidebars Width
*/
$wp_customize->add_setting(
'ocean_ld_lesson_both_sidebars_sidebars_width',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
)
);
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'ocean_ld_lesson_both_sidebars_sidebars_width',
array(
'label' => esc_html__( 'Both Sidebars: Sidebars Width (%)', 'oceanwp' ),
'type' => 'number',
'section' => 'ocean_ld_layout',
'settings' => 'ocean_ld_lesson_both_sidebars_sidebars_width',
'priority' => 10,
'input_attrs' => array(
'min' => 0,
'max' => 100,
'step' => 1,
),
'active_callback' => 'oceanwp_cac_has_ld_lesson_bs_layout',
)
)
);
/**
* Mobile Sidebar Order
*/
$wp_customize->add_setting(
'ocean_ld_lesson_sidebar_order',
array(
'default' => 'content-sidebar',
'sanitize_callback' => 'oceanwp_sanitize_select',
)
);
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'ocean_ld_lesson_sidebar_order',
array(
'label' => esc_html__( 'Mobile Sidebar Order', 'oceanwp' ),
'type' => 'select',
'section' => 'ocean_ld_layout',
'settings' => 'ocean_ld_lesson_sidebar_order',
'priority' => 10,
'choices' => array(
'content-sidebar' => esc_html__( 'Content / Sidebar', 'oceanwp' ),
'sidebar-content' => esc_html__( 'Sidebar / Content', 'oceanwp' ),
),
'active_callback' => 'oceanwp_cac_has_ld_lesson_rl_layout',
)
)
);
/**
* Section
*/
$wp_customize->add_section(
'ocean_ld_styling',
array(
'title' => esc_html__( 'Advanced Styling', 'oceanwp' ),
'description' => esc_html__( 'For some options, you must save and refresh your live site to preview changes.', 'oceanwp' ),
'priority' => 10,
'panel' => $panel,
)
);
/**
* Course
*/
$wp_customize->add_setting(
'ocean_lld_styling_course',
array(
'sanitize_callback' => 'wp_kses',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Heading_Control(
$wp_customize,
'ocean_lld_styling_course',
array(
'label' => esc_html__( 'Table', 'oceanwp' ),
'section' => 'ocean_ld_styling',
'priority' => 10,
)
)
);
/**
* Table Heading Color
*/
$wp_customize->add_setting(
'ocean_ld_heading_color',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_color',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Color_Control(
$wp_customize,
'ocean_ld_heading_color',
array(
'label' => esc_html__( 'Heading Color', 'oceanwp' ),
'section' => 'ocean_ld_styling',
'settings' => 'ocean_ld_heading_color',
'priority' => 10,
)
)
);
/**
* Table Heading Background Color
*/
$wp_customize->add_setting(
'ocean_ld_heading_bg_color',
array(
'default' => '',
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_color',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Color_Control(
$wp_customize,
'ocean_ld_heading_bg_color',
array(
'label' => esc_html__( 'Heading Background Color', 'oceanwp' ),
'section' => 'ocean_ld_styling',
'settings' => 'ocean_ld_heading_bg_color',
'priority' => 10,
)
)
);
/**
* Item Color
*/
$wp_customize->add_setting(
'ocean_ld_item_color',
array(
'default' => '#333',
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_color',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Color_Control(
$wp_customize,
'ocean_ld_item_color',
array(
'label' => esc_html__( 'Item Color', 'oceanwp' ),
'section' => 'ocean_ld_styling',
'settings' => 'ocean_ld_item_color',
'priority' => 10,
)
)
);
/**
* Item Hover Color
*/
$wp_customize->add_setting(
'ocean_ld_item_hover_color',
array(
'default' => '#333',
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_color',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Color_Control(
$wp_customize,
'ocean_ld_item_hover_color',
array(
'label' => esc_html__( 'Item Hover Color', 'oceanwp' ),
'section' => 'ocean_ld_styling',
'settings' => 'ocean_ld_item_hover_color',
'priority' => 10,
)
)
);
/**
* Complete Color
*/
$wp_customize->add_setting(
'ocean_ld_complete_color',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_color',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Color_Control(
$wp_customize,
'ocean_ld_complete_color',
array(
'label' => esc_html__( 'Complete Color', 'oceanwp' ),
'section' => 'ocean_ld_styling',
'settings' => 'ocean_ld_complete_color',
'priority' => 10,
)
)
);
/**
* Incomplete Color
*/
$wp_customize->add_setting(
'ocean_ld_incomplete_color',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_color',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Color_Control(
$wp_customize,
'ocean_ld_incomplete_color',
array(
'label' => esc_html__( 'Incomplete Color', 'oceanwp' ),
'section' => 'ocean_ld_styling',
'settings' => 'ocean_ld_incomplete_color',
'priority' => 10,
)
)
);
/**
* Progress Bar Color
*/
$wp_customize->add_setting(
'ocean_ld_progressbar_color',
array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_color',
)
);
$wp_customize->add_control(
new OceanWP_Customizer_Color_Control(
$wp_customize,
'ocean_ld_progressbar_color',
array(
'label' => esc_html__( 'Progress Bar Color', 'oceanwp' ),
'section' => 'ocean_ld_styling',
'settings' => 'ocean_ld_progressbar_color',
'priority' => 10,
)
)
);
}
/**
* Get CSS
*
* @param obj $output css output.
* @since 1.0.0
*/
public static function head_css( $output ) {
// Course Table.
$heading_color = get_theme_mod( 'ocean_ld_heading_color' );
$heading_bg_color = get_theme_mod( 'ocean_ld_heading_bg_color' );
$item_color = get_theme_mod( 'ocean_ld_item_color' );
$item_hover_color = get_theme_mod( 'ocean_ld_item_hover_color' );
$complete_color = get_theme_mod( 'ocean_ld_complete_color' );
$incomplete_color = get_theme_mod( 'ocean_ld_incomplete_color' );
$progressbar_color = get_theme_mod( 'ocean_ld_progressbar_color' );
// Both Sidebars - Global.
$ld_global_layout = get_theme_mod( 'ocean_ld_global_layout', 'full-width' );
$bs_global_content_width = get_theme_mod( 'ocean_ld_global_both_sidebars_content_width' );
$bs_global_sidebars_width = get_theme_mod( 'ocean_ld_global_both_sidebars_sidebars_width' );
// Both Sidebars - Course.
$ld_course_layout = get_theme_mod( 'ocean_ld_course_layout', 'left-sidebar' );
$bs_course_content_width = get_theme_mod( 'ocean_ld_course_both_sidebars_content_width' );
$bs_course_sidebars_width = get_theme_mod( 'ocean_ld_course_both_sidebars_sidebars_width' );
// Both Sidebars - Lesson.
$ld_lesson_layout = get_theme_mod( 'ocean_ld_lesson_layout', 'left-sidebar' );
$bs_lesson_content_width = get_theme_mod( 'ocean_ld_lesson_both_sidebars_content_width' );
$bs_lesson_sidebars_width = get_theme_mod( 'ocean_ld_lesson_both_sidebars_sidebars_width' );
// Define css var.
$css = '';
// Add Heading color.
if ( ! empty( $heading_color ) ) {
$css .= '#learndash_lessons #lesson_heading, #learndash_profile .learndash_profile_heading, #learndash_quizzes #quiz_heading, #learndash_lesson_topics_list div > strong{color:' . $heading_color . ';}';
}
// Add Heading Background color.
if ( ! empty( $heading_bg_color ) ) {
$css .= '#learndash_lessons #lesson_heading, #learndash_profile .learndash_profile_heading, #learndash_quizzes #quiz_heading, #learndash_lesson_topics_list div > strong{background-color:' . $heading_bg_color . ';}';
}
// Add Item color.
if ( ! empty( $item_color ) ) {
$css .= '#lessons_list > div h4 a, #course_list > div h4 a, #quiz_list > div h4 a, .learndash_topic_dots a, .learndash_topic_dots a > span, #learndash_lesson_topics_list span a{color:' . $item_color . ';}';
}
// Add Item Hover color.
if ( ! empty( $item_hover_color ) ) {
$css .= '#lessons_list > div h4 a:hover, #lessons_list > div h4 a:hover > span, #course_list > div h4 a:hover, #course_list > div h4 a:hover > span, #quiz_list > div h4 a:hover, #quiz_list > div h4 a:hover > span, .learndash_topic_dots a:hover, .learndash_topic_dots a:hover span, #learndash_lesson_topics_list span a:hover{color:' . $item_hover_color . ';}';
}
// Add Complete Icon color.
if ( ! empty( $complete_color ) ) {
$css .= '.learndash_navigation_lesson_topics_list .topic-completed span:before, .learndash_navigation_lesson_topics_list ul .topic-completed span:before, .learndash_topic_dots .topic-completed span:before, .learndash_topic_dots ul .topic-completed span:before, .learndash .completed:before, #learndash_profile .completed:before{color:' . $complete_color . ';}';
}
// Add Incomplete Icon color.
if ( ! empty( $incomplete_color ) ) {
$css .= '.learndash_navigation_lesson_topics_list .topic-notcompleted span:before, .learndash_navigation_lesson_topics_list ul .topic-notcompleted span:before, .learndash_topic_dots .topic-notcompleted span:before, .learndash_topic_dots ul .topic-notcompleted span:before, .learndash .notcompleted:before, #learndash_profile .notcompleted:before{color:' . $incomplete_color . ';}';
}
// Add Progress Bar color.
if ( ! empty( $progressbar_color ) ) {
$css .= 'dd.course_progress div.course_progress_blue{background-color:' . $progressbar_color . ';}';
}
// LearnDash Both Sidebars - Global.
if ( 'both-sidebars' === $ld_global_layout ) {
// Both Sidebars layout ld Global page content width.
if ( ! empty( $bs_global_content_width ) ) {
$css .=
'@media only screen and (min-width: 960px){
body.ld-global-layout.content-both-sidebars .content-area {width: ' . $bs_global_content_width . '%;}
body.ld-global-layout.content-both-sidebars.scs-style .widget-area.sidebar-secondary,
body.ld-global-layout.content-both-sidebars.ssc-style .widget-area {left: -' . $bs_global_content_width . '%;}
}';
}
// Both Sidebars layout ld Global sidebars width.
if ( ! empty( $bs_global_sidebars_width ) ) {
$css .=
'@media only screen and (min-width: 960px){
body.ld-global-layout.content-both-sidebars .widget-area{width:' . $bs_global_sidebars_width . '%;}
body.ld-global-layout.content-both-sidebars.scs-style .content-area{left:' . $bs_global_sidebars_width . '%;}
body.ld-global-layout.content-both-sidebars.ssc-style .content-area{left:' . $bs_global_sidebars_width * 2 . '%;}
}';
}
}
// LearnDash Both Sidebars - Course.
if ( 'both-sidebars' === $ld_course_layout ) {
// Both Sidebars layout ld Course page content width.
if ( ! empty( $bs_course_content_width ) ) {
$css .=
'@media only screen and (min-width: 960px){
body.single-sfwd-courses.content-both-sidebars .content-area {width: ' . $bs_course_content_width . '%;}
body.single-sfwd-courses.content-both-sidebars.scs-style .widget-area.sidebar-secondary,
body.single-sfwd-courses.content-both-sidebars.ssc-style .widget-area {left: -' . $bs_course_content_width . '%;}
}';
}
// Both Sidebars layout ld Course sidebars width.
if ( ! empty( $bs_course_sidebars_width ) ) {
$css .=
'@media only screen and (min-width: 960px){
body.single-sfwd-courses.content-both-sidebars .widget-area{width:' . $bs_course_sidebars_width . '%;}
body.single-sfwd-courses.content-both-sidebars.scs-style .content-area{left:' . $bs_course_sidebars_width . '%;}
body.single-sfwd-courses.content-both-sidebars.ssc-style .content-area{left:' . $bs_course_sidebars_width * 2 . '%;}
}';
}
}
// LearnDash Both Sidebars - Lesson.
if ( 'both-sidebars' === $ld_lesson_layout ) {
// Both Sidebars layout ld Lesson page content width.
if ( ! empty( $bs_lesson_content_width ) ) {
$css .=
'@media only screen and (min-width: 960px){
body.single-sfwd-lessons.content-both-sidebars .content-area, body.single-sfwd-topic.content-both-sidebars .content-area {width: ' . $bs_lesson_content_width . '%;}
body.single-sfwd-lessons.content-both-sidebars.scs-style .widget-area.sidebar-secondary,
body.single-sfwd-lessons.content-both-sidebars.ssc-style .widget-area, body.single-sfwd-topic.content-both-sidebars.scs-style .widget-area.sidebar-secondary,
body.single-sfwd-topic.content-both-sidebars.ssc-style .widget-area {left: -' . $bs_lesson_content_width . '%;}
}';
}
// Both Sidebars layout ld Lesson sidebars width.
if ( ! empty( $bs_lesson_sidebars_width ) ) {
$css .=
'@media only screen and (min-width: 960px){
body.single-sfwd-lessons.content-both-sidebars .widget-area, body.single-sfwd-topic.content-both-sidebars .widget-area{width:' . $bs_lesson_sidebars_width . '%;}
body.single-sfwd-lessons.content-both-sidebars.scs-style .content-area,
body.single-sfwd-topic.content-both-sidebars.scs-style .content-area{left:' . $bs_lesson_sidebars_width . '%;}
body.single-sfwd-lessons.content-both-sidebars.ssc-style .content-area,
body.single-sfwd-topic.content-both-sidebars.ssc-style .content-area{left:' . $bs_lesson_sidebars_width * 2 . '%;}
}';
}
}
// Return CSS.
if ( ! empty( $css ) ) {
$output .= '/* LearnDash CSS */' . $css;
}
// Return output css.
return $output;
}
}
endif;
return new OceanWP_LearnDash_Customizer();
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,446 @@
<?php
/**
* Sidebar Customizer Options
*
* @package OceanWP WordPress theme
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'OceanWP_Sidebar_Customizer' ) ) :
class OceanWP_Sidebar_Customizer {
/**
* Setup class.
*
* @since 1.0
*/
public function __construct() {
add_action( 'customize_register', array( $this, 'customizer_options' ) );
add_filter( 'ocean_head_css', array( $this, 'head_css' ) );
}
/**
* Customizer options
*
* @since 1.0.0
*/
public function customizer_options( $wp_customize ) {
/**
* Section
*/
$section = 'ocean_sidebar_section';
$wp_customize->add_section( $section , array(
'title' => esc_html__( 'Sidebar', 'oceanwp' ),
'priority' => 210,
) );
/**
* Sidebar Background
*/
$wp_customize->add_setting( 'ocean_sidebar_bg', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_color',
) );
$wp_customize->add_control( new OceanWP_Customizer_Color_Control( $wp_customize, 'ocean_sidebar_bg', array(
'label' => esc_html__( 'Background Color', 'oceanwp' ),
'section' => $section,
'settings' => 'ocean_sidebar_bg',
'priority' => 10,
) ) );
/**
* Sidebar Padding
*/
$wp_customize->add_setting( 'ocean_sidebar_top_padding', array(
'transport' => 'postMessage',
'default' => '0',
'sanitize_callback' => 'oceanwp_sanitize_number',
) );
$wp_customize->add_setting( 'ocean_sidebar_right_padding', array(
'transport' => 'postMessage',
'default' => '0',
'sanitize_callback' => 'oceanwp_sanitize_number',
) );
$wp_customize->add_setting( 'ocean_sidebar_bottom_padding', array(
'transport' => 'postMessage',
'default' => '0',
'sanitize_callback' => 'oceanwp_sanitize_number',
) );
$wp_customize->add_setting( 'ocean_sidebar_left_padding', array(
'transport' => 'postMessage',
'default' => '30',
'sanitize_callback' => 'oceanwp_sanitize_number',
) );
$wp_customize->add_setting( 'ocean_sidebar_tablet_top_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( 'ocean_sidebar_tablet_right_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( 'ocean_sidebar_tablet_bottom_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( 'ocean_sidebar_tablet_left_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( 'ocean_sidebar_mobile_top_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( 'ocean_sidebar_mobile_right_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( 'ocean_sidebar_mobile_bottom_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( 'ocean_sidebar_mobile_left_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_control( new OceanWP_Customizer_Dimensions_Control( $wp_customize, 'ocean_sidebar_padding_dimensions', array(
'label' => esc_html__( 'Padding (px)', 'oceanwp' ),
'section' => $section,
'settings' => array(
'desktop_top' => 'ocean_sidebar_top_padding',
'desktop_right' => 'ocean_sidebar_right_padding',
'desktop_bottom' => 'ocean_sidebar_bottom_padding',
'desktop_left' => 'ocean_sidebar_left_padding',
'tablet_top' => 'ocean_sidebar_tablet_top_padding',
'tablet_right' => 'ocean_sidebar_tablet_right_padding',
'tablet_bottom' => 'ocean_sidebar_tablet_bottom_padding',
'tablet_left' => 'ocean_sidebar_tablet_left_padding',
'mobile_top' => 'ocean_sidebar_mobile_top_padding',
'mobile_right' => 'ocean_sidebar_mobile_right_padding',
'mobile_bottom' => 'ocean_sidebar_mobile_bottom_padding',
'mobile_left' => 'ocean_sidebar_mobile_left_padding',
),
'priority' => 10,
'input_attrs' => array(
'min' => 0,
'max' => 500,
'step' => 1,
),
) ) );
/**
* Widgets Heading
*/
$wp_customize->add_setting( 'ocean_widgets_heading', array(
'sanitize_callback' => 'wp_kses',
) );
$wp_customize->add_control( new OceanWP_Customizer_Heading_Control( $wp_customize, 'ocean_widgets_heading', array(
'label' => esc_html__( 'Widgets', 'oceanwp' ),
'section' => $section,
'priority' => 10,
) ) );
/**
* Widgets Background
*/
$wp_customize->add_setting( 'ocean_widgets_bg', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_color',
) );
$wp_customize->add_control( new OceanWP_Customizer_Color_Control( $wp_customize, 'ocean_widgets_bg', array(
'label' => esc_html__( 'Background Color', 'oceanwp' ),
'section' => $section,
'settings' => 'ocean_widgets_bg',
'priority' => 10,
) ) );
/**
* Widgets Padding
*/
$wp_customize->add_setting( 'ocean_widgets_top_padding', array(
'transport' => 'postMessage',
'default' => '0',
'sanitize_callback' => 'oceanwp_sanitize_number',
) );
$wp_customize->add_setting( 'ocean_widgets_right_padding', array(
'transport' => 'postMessage',
'default' => '0',
'sanitize_callback' => 'oceanwp_sanitize_number',
) );
$wp_customize->add_setting( 'ocean_widgets_bottom_padding', array(
'transport' => 'postMessage',
'default' => '0',
'sanitize_callback' => 'oceanwp_sanitize_number',
) );
$wp_customize->add_setting( 'ocean_widgets_left_padding', array(
'transport' => 'postMessage',
'default' => '0',
'sanitize_callback' => 'oceanwp_sanitize_number',
) );
$wp_customize->add_setting( 'ocean_widgets_tablet_top_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( 'ocean_widgets_tablet_right_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( 'ocean_widgets_tablet_bottom_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( 'ocean_widgets_tablet_left_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( 'ocean_widgets_mobile_top_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( 'ocean_widgets_mobile_right_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( 'ocean_widgets_mobile_bottom_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( 'ocean_widgets_mobile_left_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_control( new OceanWP_Customizer_Dimensions_Control( $wp_customize, 'ocean_widgets_padding_dimensions', array(
'label' => esc_html__( 'Padding (px)', 'oceanwp' ),
'section' => $section,
'settings' => array(
'desktop_top' => 'ocean_widgets_top_padding',
'desktop_right' => 'ocean_widgets_right_padding',
'desktop_bottom' => 'ocean_widgets_bottom_padding',
'desktop_left' => 'ocean_widgets_left_padding',
'tablet_top' => 'ocean_widgets_tablet_top_padding',
'tablet_right' => 'ocean_widgets_tablet_right_padding',
'tablet_bottom' => 'ocean_widgets_tablet_bottom_padding',
'tablet_left' => 'ocean_widgets_tablet_left_padding',
'mobile_top' => 'ocean_widgets_mobile_top_padding',
'mobile_right' => 'ocean_widgets_mobile_right_padding',
'mobile_bottom' => 'ocean_widgets_mobile_bottom_padding',
'mobile_left' => 'ocean_widgets_mobile_left_padding',
),
'priority' => 10,
'input_attrs' => array(
'min' => 0,
'max' => 500,
'step' => 1,
),
) ) );
/**
* Widgets Margin Bottom
*/
$wp_customize->add_setting( 'ocean_widgets_margin_bottom', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'ocean_widgets_margin_bottom', array(
'label' => esc_html__( 'Margin Bottom (px)', 'oceanwp' ),
'type' => 'number',
'section' => $section,
'settings' => 'ocean_widgets_margin_bottom',
'priority' => 10,
'input_attrs' => array(
'min' => 0,
'max' => 100,
'step' => 1,
),
) ) );
/**
* Widgets Title Border Color
*/
$wp_customize->add_setting( 'ocean_widgets_titles_border_color', array(
'transport' => 'postMessage',
'default' => '#13aff0',
'sanitize_callback' => 'oceanwp_sanitize_color',
) );
$wp_customize->add_control( new OceanWP_Customizer_Color_Control( $wp_customize, 'ocean_widgets_titles_border_color', array(
'label' => esc_html__( 'Titles Border Color', 'oceanwp' ),
'section' => $section,
'settings' => 'ocean_widgets_titles_border_color',
'priority' => 10,
) ) );
/**
* Widgets Titles Margin Bottom
*/
$wp_customize->add_setting( 'ocean_widgets_titles_margin_bottom', array(
'transport' => 'postMessage',
'default' => '20',
'sanitize_callback' => 'oceanwp_sanitize_number',
) );
$wp_customize->add_control( new OceanWP_Customizer_Range_Control( $wp_customize, 'ocean_widgets_titles_margin_bottom', array(
'label' => esc_html__( 'Titles Margin Bottom (px)', 'oceanwp' ),
'section' => $section,
'settings' => 'ocean_widgets_titles_margin_bottom',
'priority' => 10,
'input_attrs' => array(
'min' => 0,
'max' => 100,
'step' => 1,
),
) ) );
}
/**
* Get CSS
*
* @since 1.0.0
*/
public static function head_css( $output ) {
// Global vars
$sidebar_bg = get_theme_mod( 'ocean_sidebar_bg' );
$sidebar_top_padding = get_theme_mod( 'ocean_sidebar_top_padding', '0' );
$sidebar_right_padding = get_theme_mod( 'ocean_sidebar_right_padding', '0' );
$sidebar_bottom_padding = get_theme_mod( 'ocean_sidebar_bottom_padding', '0' );
$sidebar_left_padding = get_theme_mod( 'ocean_sidebar_left_padding', '30' );
$tablet_sidebar_top_padding = get_theme_mod( 'ocean_sidebar_tablet_top_padding' );
$tablet_sidebar_right_padding = get_theme_mod( 'ocean_sidebar_tablet_right_padding' );
$tablet_sidebar_bottom_padding = get_theme_mod( 'ocean_sidebar_tablet_bottom_padding' );
$tablet_sidebar_left_padding = get_theme_mod( 'ocean_sidebar_tablet_left_padding' );
$mobile_sidebar_top_padding = get_theme_mod( 'ocean_sidebar_mobile_top_padding' );
$mobile_sidebar_right_padding = get_theme_mod( 'ocean_sidebar_mobile_right_padding' );
$mobile_sidebar_bottom_padding = get_theme_mod( 'ocean_sidebar_mobile_bottom_padding' );
$mobile_sidebar_left_padding = get_theme_mod( 'ocean_sidebar_mobile_left_padding' );
$widgets_bg = get_theme_mod( 'ocean_widgets_bg' );
$widgets_top_padding = get_theme_mod( 'ocean_widgets_top_padding', '0' );
$widgets_right_padding = get_theme_mod( 'ocean_widgets_right_padding', '0' );
$widgets_bottom_padding = get_theme_mod( 'ocean_widgets_bottom_padding', '0' );
$widgets_left_padding = get_theme_mod( 'ocean_widgets_left_padding', '0' );
$tablet_widgets_top_padding = get_theme_mod( 'ocean_widgets_tablet_top_padding' );
$tablet_widgets_right_padding = get_theme_mod( 'ocean_widgets_tablet_right_padding' );
$tablet_widgets_bottom_padding = get_theme_mod( 'ocean_widgets_tablet_bottom_padding' );
$tablet_widgets_left_padding = get_theme_mod( 'ocean_widgets_tablet_left_padding' );
$mobile_widgets_top_padding = get_theme_mod( 'ocean_widgets_mobile_top_padding' );
$mobile_widgets_right_padding = get_theme_mod( 'ocean_widgets_mobile_right_padding' );
$mobile_widgets_bottom_padding = get_theme_mod( 'ocean_widgets_mobile_bottom_padding' );
$mobile_widgets_left_padding = get_theme_mod( 'ocean_widgets_mobile_left_padding' );
$widgets_margin_bottom = get_theme_mod( 'ocean_widgets_margin_bottom' );
$widgets_titles_border_color = get_theme_mod( 'ocean_widgets_titles_border_color', '#13aff0' );
$widgets_titles_margin_bottom = get_theme_mod( 'ocean_widgets_titles_margin_bottom', '20' );
// Define css var
$css = '';
// Sidebar background
if ( ! empty( $sidebar_bg ) ) {
$css .= '.widget-area{background-color:'. $sidebar_bg .';}';
}
// Sidebar padding
if ( isset( $sidebar_top_padding ) && '0' != $sidebar_top_padding && '' != $sidebar_top_padding
|| isset( $sidebar_right_padding ) && '0' != $sidebar_right_padding && '' != $sidebar_right_padding
|| isset( $sidebar_bottom_padding ) && '0' != $sidebar_bottom_padding && '' != $sidebar_bottom_padding
|| isset( $sidebar_left_padding ) && '30' != $sidebar_left_padding && '' != $sidebar_left_padding ) {
$css .= '.widget-area{padding:'. oceanwp_spacing_css( $sidebar_top_padding, $sidebar_right_padding, $sidebar_bottom_padding, $sidebar_left_padding ) .'!important}';
}
// Tablet sidebar padding
if ( isset( $tablet_sidebar_top_padding ) && '' != $tablet_sidebar_top_padding
|| isset( $tablet_sidebar_right_padding ) && '' != $tablet_sidebar_right_padding
|| isset( $tablet_sidebar_bottom_padding ) && '' != $tablet_sidebar_bottom_padding
|| isset( $tablet_sidebar_left_padding ) && '' != $tablet_sidebar_left_padding ) {
$css .= '@media (max-width: 768px){.widget-area{padding:'. oceanwp_spacing_css( $tablet_sidebar_top_padding, $tablet_sidebar_right_padding, $tablet_sidebar_bottom_padding, $tablet_sidebar_left_padding ) .'!important}}';
}
// Mobile sidebar padding
if ( isset( $mobile_sidebar_top_padding ) && '' != $mobile_sidebar_top_padding
|| isset( $mobile_sidebar_right_padding ) && '' != $mobile_sidebar_right_padding
|| isset( $mobile_sidebar_bottom_padding ) && '' != $mobile_sidebar_bottom_padding
|| isset( $mobile_sidebar_left_padding ) && '' != $mobile_sidebar_left_padding ) {
$css .= '@media (max-width: 480px){.widget-area{padding:'. oceanwp_spacing_css( $mobile_sidebar_top_padding, $mobile_sidebar_right_padding, $mobile_sidebar_bottom_padding, $mobile_sidebar_left_padding ) .'!important}}';
}
// Widgets background
if ( ! empty( $widgets_bg ) ) {
$css .= '.widget-area .sidebar-box{background-color:'. $widgets_bg .';}';
}
// Widgets padding
if ( ! empty( $widgets_padding ) ) {
$css .= '.widget-area .sidebar-box{padding:'. $widgets_padding .';}';
}
// Widget padding
if ( isset( $widgets_top_padding ) && '0' != $widgets_top_padding && '' != $widgets_top_padding
|| isset( $widgets_right_padding ) && '0' != $widgets_right_padding && '' != $widgets_right_padding
|| isset( $widgets_bottom_padding ) && '0' != $widgets_bottom_padding && '' != $widgets_bottom_padding
|| isset( $widgets_left_padding ) && '0' != $widgets_left_padding && '' != $widgets_left_padding ) {
$css .= '.widget-area .sidebar-box{padding:'. oceanwp_spacing_css( $widgets_top_padding, $widgets_right_padding, $widgets_bottom_padding, $widgets_left_padding ) .'}';
}
// Tablet widget padding
if ( isset( $tablet_widgets_top_padding ) && '' != $tablet_widgets_top_padding
|| isset( $tablet_widgets_right_padding ) && '' != $tablet_widgets_right_padding
|| isset( $tablet_widgets_bottom_padding ) && '' != $tablet_widgets_bottom_padding
|| isset( $tablet_widgets_left_padding ) && '' != $tablet_widgets_left_padding ) {
$css .= '@media (max-width: 768px){.widget-area .sidebar-box{padding:'. oceanwp_spacing_css( $tablet_widgets_top_padding, $tablet_widgets_right_padding, $tablet_widgets_bottom_padding, $tablet_widgets_left_padding ) .'}}';
}
// Mobile widget padding
if ( isset( $mobile_widgets_top_padding ) && '' != $mobile_widgets_top_padding
|| isset( $mobile_widgets_right_padding ) && '' != $mobile_widgets_right_padding
|| isset( $mobile_widgets_bottom_padding ) && '' != $mobile_widgets_bottom_padding
|| isset( $mobile_widgets_left_padding ) && '' != $mobile_widgets_left_padding ) {
$css .= '@media (max-width: 480px){.widget-area .sidebar-box{padding:'. oceanwp_spacing_css( $mobile_widgets_top_padding, $mobile_widgets_right_padding, $mobile_widgets_bottom_padding, $mobile_widgets_left_padding ) .'}}';
}
// Widgets margin bottom
if ( ! empty( $widgets_margin_bottom ) ) {
$css .= '.widget-area .sidebar-box, .separate-layout .sidebar-box{margin-bottom:'. $widgets_margin_bottom .'px;}';
}
// Widgets titles border color
if ( ! empty( $widgets_titles_border_color ) && '#13aff0' != $widgets_titles_border_color ) {
$css .= '.widget-title{border-color:'. $widgets_titles_border_color .';}';
}
// Widgets titles margin bottom
if ( ! empty( $widgets_titles_margin_bottom ) && '20' != $widgets_titles_margin_bottom ) {
$css .= '.widget-title{margin-bottom:'. $widgets_titles_margin_bottom .'px;}';
}
// Return CSS
if ( ! empty( $css ) ) {
$output .= '/* Sidebar CSS */'. $css;
}
// Return output css
return $output;
}
}
endif;
return new OceanWP_Sidebar_Customizer();
@@ -0,0 +1,711 @@
<?php
/**
* Top Bar Customizer Options
*
* @package OceanWP WordPress theme
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'OceanWP_Top_Bar_Customizer' ) ) :
class OceanWP_Top_Bar_Customizer {
/**
* Setup class.
*
* @since 1.0
*/
public function __construct() {
add_action( 'customize_register', array( $this, 'customizer_options' ) );
add_filter( 'ocean_head_css', array( $this, 'head_css' ) );
}
/**
* Customizer options
*
* @since 1.0.0
*/
public function customizer_options( $wp_customize ) {
/**
* Panel
*/
$panel = 'ocean_topbar_panel';
$wp_customize->add_panel( $panel , array(
'title' => esc_html__( 'Top Bar', 'oceanwp' ),
'priority' => 210,
) );
/**
* Section
*/
$wp_customize->add_section( 'ocean_topbar_general' , array(
'title' => esc_html__( 'General', 'oceanwp' ),
'priority' => 10,
'panel' => $panel,
) );
/**
* Top Bar
*/
$wp_customize->add_setting( 'ocean_top_bar', array(
'default' => true,
'sanitize_callback' => 'oceanwp_sanitize_checkbox',
) );
$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'ocean_top_bar', array(
'label' => esc_html__( 'Enable Top Bar', 'oceanwp' ),
'type' => 'checkbox',
'section' => 'ocean_topbar_general',
'settings' => 'ocean_top_bar',
'priority' => 10,
) ) );
/**
* Top Bar Full Width
*/
$wp_customize->add_setting( 'ocean_top_bar_full_width', array(
'transport' => 'postMessage',
'default' => false,
'sanitize_callback' => 'oceanwp_sanitize_checkbox',
) );
$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'ocean_top_bar_full_width', array(
'label' => esc_html__( 'Top Bar Full Width', 'oceanwp' ),
'type' => 'checkbox',
'section' => 'ocean_topbar_general',
'settings' => 'ocean_top_bar_full_width',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar',
) ) );
/**
* Top Bar Visibility
*/
$wp_customize->add_setting( 'ocean_top_bar_visibility', array(
'transport' => 'postMessage',
'default' => 'all-devices',
'sanitize_callback' => 'oceanwp_sanitize_select',
) );
$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'ocean_top_bar_visibility', array(
'label' => esc_html__( 'Visibility', 'oceanwp' ),
'type' => 'select',
'section' => 'ocean_topbar_general',
'settings' => 'ocean_top_bar_visibility',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar',
'choices' => array(
'all-devices' => esc_html__( 'Show On All Devices', 'oceanwp' ),
'hide-tablet' => esc_html__( 'Hide On Tablet', 'oceanwp' ),
'hide-mobile' => esc_html__( 'Hide On Mobile', 'oceanwp' ),
'hide-tablet-mobile' => esc_html__( 'Hide On Tablet & Mobile', 'oceanwp' ),
),
) ) );
/**
* Top Bar Style
*/
$wp_customize->add_setting( 'ocean_top_bar_style', array(
'default' => 'one',
'sanitize_callback' => 'oceanwp_sanitize_select',
) );
$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'ocean_top_bar_style', array(
'label' => esc_html__( 'Style', 'oceanwp' ),
'type' => 'select',
'section' => 'ocean_topbar_general',
'settings' => 'ocean_top_bar_style',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar',
'choices' => array(
'one' => esc_html__( 'Left Content & Right Social', 'oceanwp' ),
'two' => esc_html__( 'Left Social & Right Content', 'oceanwp' ),
'three' => esc_html__( 'Centered Content & Social', 'oceanwp' ),
),
) ) );
/**
* Top Bar Padding
*/
$wp_customize->add_setting( 'ocean_top_bar_top_padding', array(
'transport' => 'postMessage',
'default' => '8',
'sanitize_callback' => 'oceanwp_sanitize_number',
) );
$wp_customize->add_setting( 'ocean_top_bar_right_padding', array(
'transport' => 'postMessage',
'default' => '0',
'sanitize_callback' => 'oceanwp_sanitize_number',
) );
$wp_customize->add_setting( 'ocean_top_bar_bottom_padding', array(
'transport' => 'postMessage',
'default' => '8',
'sanitize_callback' => 'oceanwp_sanitize_number',
) );
$wp_customize->add_setting( 'ocean_top_bar_left_padding', array(
'transport' => 'postMessage',
'default' => '0',
'sanitize_callback' => 'oceanwp_sanitize_number',
) );
$wp_customize->add_setting( 'ocean_top_bar_tablet_top_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( 'ocean_top_bar_tablet_right_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( 'ocean_top_bar_tablet_bottom_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( 'ocean_top_bar_tablet_left_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( 'ocean_top_bar_mobile_top_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( 'ocean_top_bar_mobile_right_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( 'ocean_top_bar_mobile_bottom_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( 'ocean_top_bar_mobile_left_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_control( new OceanWP_Customizer_Dimensions_Control( $wp_customize, 'ocean_top_bar_padding', array(
'label' => esc_html__( 'Padding (px)', 'oceanwp' ),
'section' => 'ocean_topbar_general',
'settings' => array(
'desktop_top' => 'ocean_top_bar_top_padding',
'desktop_right' => 'ocean_top_bar_right_padding',
'desktop_bottom' => 'ocean_top_bar_bottom_padding',
'desktop_left' => 'ocean_top_bar_left_padding',
'tablet_top' => 'ocean_top_bar_tablet_top_padding',
'tablet_right' => 'ocean_top_bar_tablet_right_padding',
'tablet_bottom' => 'ocean_top_bar_tablet_bottom_padding',
'tablet_left' => 'ocean_top_bar_tablet_left_padding',
'mobile_top' => 'ocean_top_bar_mobile_top_padding',
'mobile_right' => 'ocean_top_bar_mobile_right_padding',
'mobile_bottom' => 'ocean_top_bar_mobile_bottom_padding',
'mobile_left' => 'ocean_top_bar_mobile_left_padding',
),
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar',
'input_attrs' => array(
'min' => 0,
'max' => 100,
'step' => 1,
),
) ) );
/**
* Top Bar Background Color
*/
$wp_customize->add_setting( 'ocean_top_bar_bg', array(
'transport' => 'postMessage',
'default' => '#ffffff',
'sanitize_callback' => 'oceanwp_sanitize_color',
) );
$wp_customize->add_control( new OceanWP_Customizer_Color_Control( $wp_customize, 'ocean_top_bar_bg', array(
'label' => esc_html__( 'Background Color', 'oceanwp' ),
'section' => 'ocean_topbar_general',
'settings' => 'ocean_top_bar_bg',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar',
) ) );
/**
* Top Bar Border Color
*/
$wp_customize->add_setting( 'ocean_top_bar_border_color', array(
'transport' => 'postMessage',
'default' => '#f1f1f1',
'sanitize_callback' => 'oceanwp_sanitize_color',
) );
$wp_customize->add_control( new OceanWP_Customizer_Color_Control( $wp_customize, 'ocean_top_bar_border_color', array(
'label' => esc_html__( 'Border Color', 'oceanwp' ),
'section' => 'ocean_topbar_general',
'settings' => 'ocean_top_bar_border_color',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar',
) ) );
/**
* Top Bar Text Color
*/
$wp_customize->add_setting( 'ocean_top_bar_text_color', array(
'transport' => 'postMessage',
'default' => '#929292',
'sanitize_callback' => 'oceanwp_sanitize_color',
) );
$wp_customize->add_control( new OceanWP_Customizer_Color_Control( $wp_customize, 'ocean_top_bar_text_color', array(
'label' => esc_html__( 'Text Color', 'oceanwp' ),
'section' => 'ocean_topbar_general',
'settings' => 'ocean_top_bar_text_color',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar',
) ) );
/**
* Top Bar Link Color
*/
$wp_customize->add_setting( 'ocean_top_bar_link_color', array(
'transport' => 'postMessage',
'default' => '#555555',
'sanitize_callback' => 'oceanwp_sanitize_color',
) );
$wp_customize->add_control( new OceanWP_Customizer_Color_Control( $wp_customize, 'ocean_top_bar_link_color', array(
'label' => esc_html__( 'Link Color', 'oceanwp' ),
'section' => 'ocean_topbar_general',
'settings' => 'ocean_top_bar_link_color',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar',
) ) );
/**
* Top Bar Link Color Hover
*/
$wp_customize->add_setting( 'ocean_top_bar_link_color_hover', array(
'transport' => 'postMessage',
'default' => '#13aff0',
'sanitize_callback' => 'oceanwp_sanitize_color',
) );
$wp_customize->add_control( new OceanWP_Customizer_Color_Control( $wp_customize, 'ocean_top_bar_link_color_hover', array(
'label' => esc_html__( 'Link Color: Hover', 'oceanwp' ),
'section' => 'ocean_topbar_general',
'settings' => 'ocean_top_bar_link_color_hover',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar',
) ) );
/**
* Section
*/
$wp_customize->add_section( 'ocean_topbar_content' , array(
'title' => esc_html__( 'Content', 'oceanwp' ),
'priority' => 10,
'panel' => $panel,
) );
/**
* Top Bar Template
*/
$wp_customize->add_setting( 'ocean_top_bar_template', array(
'default' => '0',
'sanitize_callback' => 'oceanwp_sanitize_select',
) );
$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'ocean_top_bar_template', array(
'label' => esc_html__( 'Select Template', 'oceanwp' ),
'description' => esc_html__( 'Choose a template created in Theme Panel > My Library to replace the content.', 'oceanwp' ),
'type' => 'select',
'section' => 'ocean_topbar_content',
'settings' => 'ocean_top_bar_template',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar',
'choices' => oceanwp_customizer_helpers( 'library' ),
) ) );
/**
* Top Bar Content
*/
$wp_customize->add_setting( 'ocean_top_bar_content', array(
'transport' => 'postMessage',
'default' => esc_html__( 'Place your content here', 'oceanwp' ),
'sanitize_callback' => 'wp_kses_post',
) );
$wp_customize->add_control( new OceanWP_Customizer_Textarea_Control( $wp_customize, 'ocean_top_bar_content', array(
'label' => esc_html__( 'Content', 'oceanwp' ),
'description' => sprintf( esc_html__( 'Shortcodes allowed, %1$ssee the list%2$s.', 'oceanwp' ), '<a href="http://docs.oceanwp.org/category/369-shortcodes" target="_blank">', '</a>' ),
'section' => 'ocean_topbar_content',
'settings' => 'ocean_top_bar_content',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar',
) ) );
/**
* Section
*/
$wp_customize->add_section( 'ocean_topbar_social' , array(
'title' => esc_html__( 'Social', 'oceanwp' ),
'priority' => 10,
'panel' => $panel,
) );
/**
* Top Bar Social
*/
$wp_customize->add_setting( 'ocean_top_bar_social', array(
'default' => true,
'sanitize_callback' => 'oceanwp_sanitize_checkbox',
) );
$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'ocean_top_bar_social', array(
'label' => esc_html__( 'Enable Social', 'oceanwp' ),
'type' => 'checkbox',
'section' => 'ocean_topbar_social',
'settings' => 'ocean_top_bar_social',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar',
) ) );
/**
* Top Bar Social Alternative
*/
$wp_customize->add_setting( 'ocean_top_bar_social_alt_template', array(
'default' => '0',
'sanitize_callback' => 'oceanwp_sanitize_select',
) );
$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'ocean_top_bar_social_alt_template', array(
'label' => esc_html__( 'Social Alternative', 'oceanwp' ),
'description' => esc_html__( 'Choose a template created in Theme Panel > My Library.', 'oceanwp' ),
'type' => 'select',
'section' => 'ocean_topbar_social',
'settings' => 'ocean_top_bar_social_alt_template',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar_social',
'choices' => oceanwp_customizer_helpers( 'library' ),
) ) );
/**
* Top Bar Social Link Target
*/
$wp_customize->add_setting( 'ocean_top_bar_social_target', array(
'transport' => 'postMessage',
'default' => 'blank',
'sanitize_callback' => 'oceanwp_sanitize_select',
) );
$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'ocean_top_bar_social_target', array(
'label' => esc_html__( 'Social Link Target', 'oceanwp' ),
'type' => 'select',
'section' => 'ocean_topbar_social',
'settings' => 'ocean_top_bar_social_target',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar_social',
'choices' => array(
'blank' => esc_html__( 'New Window', 'oceanwp' ),
'self' => esc_html__( 'Same Window', 'oceanwp' ),
),
) ) );
/**
* Top Bar Social Font Size
*/
$wp_customize->add_setting( 'ocean_top_bar_social_font_size', array(
'transport' => 'postMessage',
'default' => '14',
'sanitize_callback' => 'oceanwp_sanitize_number',
) );
$wp_customize->add_setting( 'ocean_top_bar_social_tablet_font_size', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( 'ocean_top_bar_social_mobile_font_size', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_control( new OceanWP_Customizer_Slider_Control( $wp_customize, 'ocean_top_bar_social_font_size', array(
'label' => esc_html__( 'Font Size (px)', 'oceanwp' ),
'section' => 'ocean_topbar_social',
'settings' => array(
'desktop' => 'ocean_top_bar_social_font_size',
'tablet' => 'ocean_top_bar_social_tablet_font_size',
'mobile' => 'ocean_top_bar_social_mobile_font_size',
),
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar_social',
'input_attrs' => array(
'min' => 0,
'max' => 100,
'step' => 1,
),
) ) );
/**
* Top Bar Social Padding
*/
$wp_customize->add_setting( 'ocean_top_bar_social_right_padding', array(
'transport' => 'postMessage',
'default' => '6',
'sanitize_callback' => 'oceanwp_sanitize_number',
) );
$wp_customize->add_setting( 'ocean_top_bar_social_left_padding', array(
'transport' => 'postMessage',
'default' => '6',
'sanitize_callback' => 'oceanwp_sanitize_number',
) );
$wp_customize->add_setting( 'ocean_top_bar_social_tablet_right_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( 'ocean_top_bar_social_tablet_left_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( 'ocean_top_bar_social_mobile_right_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( 'ocean_top_bar_social_mobile_left_padding', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_control( new OceanWP_Customizer_Dimensions_Control( $wp_customize, 'ocean_top_bar_social_padding', array(
'label' => esc_html__( 'Padding (px)', 'oceanwp' ),
'section' => 'ocean_topbar_social',
'settings' => array(
'desktop_right' => 'ocean_top_bar_social_right_padding',
'desktop_left' => 'ocean_top_bar_social_left_padding',
'tablet_right' => 'ocean_top_bar_social_tablet_right_padding',
'tablet_left' => 'ocean_top_bar_social_tablet_left_padding',
'mobile_right' => 'ocean_top_bar_social_mobile_right_padding',
'mobile_left' => 'ocean_top_bar_social_mobile_left_padding',
),
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar_social',
'input_attrs' => array(
'min' => 0,
'max' => 60,
'step' => 1,
),
) ) );
/**
* Top Bar Social Link Color
*/
$wp_customize->add_setting( 'ocean_top_bar_social_links_color', array(
'transport' => 'postMessage',
'default' => '#bbbbbb',
'sanitize_callback' => 'oceanwp_sanitize_color',
) );
$wp_customize->add_control( new OceanWP_Customizer_Color_Control( $wp_customize, 'ocean_top_bar_social_links_color', array(
'label' => esc_html__( 'Social Links Color', 'oceanwp' ),
'section' => 'ocean_topbar_social',
'settings' => 'ocean_top_bar_social_links_color',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar_social',
) ) );
/**
* Top Bar Social Link Color Hover
*/
$wp_customize->add_setting( 'ocean_top_bar_social_hover_links_color', array(
'transport' => 'postMessage',
'sanitize_callback' => 'oceanwp_sanitize_color',
) );
$wp_customize->add_control( new OceanWP_Customizer_Color_Control( $wp_customize, 'ocean_top_bar_social_hover_links_color', array(
'label' => esc_html__( 'Social Links Color: Hover', 'oceanwp' ),
'section' => 'ocean_topbar_social',
'settings' => 'ocean_top_bar_social_hover_links_color',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar_social',
) ) );
/**
* Top Bar Social Settings
*/
$social_options = oceanwp_social_options();
foreach ( $social_options as $key => $val ) {
if ( 'skype' == $key ) {
$sanitize = 'wp_filter_nohtml_kses';
} else if ( 'email' == $key ) {
$sanitize = 'sanitize_email';
} else {
$sanitize = 'esc_url_raw';
}
$wp_customize->add_setting( 'ocean_top_bar_social_profiles[' . $key .']', array(
'sanitize_callback' => $sanitize,
) );
$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'ocean_top_bar_social_profiles[' . $key .']', array(
'label' => esc_html( $val['label'] ),
'type' => 'text',
'section' => 'ocean_topbar_social',
'settings' => 'ocean_top_bar_social_profiles[' . $key .']',
'priority' => 10,
'active_callback' => 'oceanwp_cac_has_topbar_social',
) ) );
}
}
/**
* Get CSS
*
* @since 1.0.0
*/
public static function head_css( $output ) {
// Global vars
$top_padding = get_theme_mod( 'ocean_top_bar_top_padding', '8' );
$right_padding = get_theme_mod( 'ocean_top_bar_right_padding', '0' );
$bottom_padding = get_theme_mod( 'ocean_top_bar_bottom_padding', '8' );
$left_padding = get_theme_mod( 'ocean_top_bar_left_padding', '0' );
$tablet_top_padding = get_theme_mod( 'ocean_top_bar_tablet_top_padding' );
$tablet_right_padding = get_theme_mod( 'ocean_top_bar_tablet_right_padding' );
$tablet_bottom_padding = get_theme_mod( 'ocean_top_bar_tablet_bottom_padding' );
$tablet_left_padding = get_theme_mod( 'ocean_top_bar_tablet_left_padding' );
$mobile_top_padding = get_theme_mod( 'ocean_top_bar_mobile_top_padding' );
$mobile_right_padding = get_theme_mod( 'ocean_top_bar_mobile_right_padding' );
$mobile_bottom_padding = get_theme_mod( 'ocean_top_bar_mobile_bottom_padding' );
$mobile_left_padding = get_theme_mod( 'ocean_top_bar_mobile_left_padding' );
$background = get_theme_mod( 'ocean_top_bar_bg', '#ffffff' );
$border_color = get_theme_mod( 'ocean_top_bar_border_color', '#f1f1f1' );
$text_color = get_theme_mod( 'ocean_top_bar_text_color', '#929292' );
$link_color = get_theme_mod( 'ocean_top_bar_link_color', '#555555' );
$link_color_hover = get_theme_mod( 'ocean_top_bar_link_color_hover', '#13aff0' );
$social_font_size = get_theme_mod( 'ocean_top_bar_social_font_size' );
$social_tablet_font_size = get_theme_mod( 'ocean_top_bar_social_tablet_font_size' );
$social_mobile_font_size = get_theme_mod( 'ocean_top_bar_social_mobile_font_size' );
$social_right_padding = get_theme_mod( 'ocean_top_bar_social_right_padding' );
$social_left_padding = get_theme_mod( 'ocean_top_bar_social_left_padding' );
$social_tablet_right_padding = get_theme_mod( 'ocean_top_bar_social_tablet_right_padding' );
$social_tablet_left_padding = get_theme_mod( 'ocean_top_bar_social_tablet_left_padding' );
$social_mobile_right_padding = get_theme_mod( 'ocean_top_bar_social_mobile_right_padding' );
$social_mobile_left_padding = get_theme_mod( 'ocean_top_bar_social_mobile_left_padding' );
$social_links_color = get_theme_mod( 'ocean_top_bar_social_links_color', '#bbbbbb' );
$social_hover_links_color = get_theme_mod( 'ocean_top_bar_social_hover_links_color' );
// Define css var
$css = '';
// Top bar padding
if ( isset( $top_padding ) && '8' != $top_padding && '' != $top_padding
|| isset( $right_padding ) && '0' != $right_padding && '' != $right_padding
|| isset( $bottom_padding ) && '8' != $bottom_padding && '' != $bottom_padding
|| isset( $left_padding ) && '0' != $left_padding && '' != $left_padding ) {
$css .= '#top-bar{padding:'. oceanwp_spacing_css( $top_padding, $right_padding, $bottom_padding, $left_padding ) .'}';
}
// Tablet top bar padding
if ( isset( $tablet_top_padding ) && '' != $tablet_top_padding
|| isset( $tablet_right_padding ) && '' != $tablet_right_padding
|| isset( $tablet_bottom_padding ) && '' != $tablet_bottom_padding
|| isset( $tablet_left_padding ) && '' != $tablet_left_padding ) {
$css .= '@media (max-width: 768px){#top-bar{padding:'. oceanwp_spacing_css( $tablet_top_padding, $tablet_right_padding, $tablet_bottom_padding, $tablet_left_padding ) .'}}';
}
// Mobile top bar padding
if ( isset( $mobile_top_padding ) && '' != $mobile_top_padding
|| isset( $mobile_right_padding ) && '' != $mobile_right_padding
|| isset( $mobile_bottom_padding ) && '' != $mobile_bottom_padding
|| isset( $mobile_left_padding ) && '' != $mobile_left_padding ) {
$css .= '@media (max-width: 480px){#top-bar{padding:'. oceanwp_spacing_css( $mobile_top_padding, $mobile_right_padding, $mobile_bottom_padding, $mobile_left_padding ) .'}}';
}
// Top bar background color
if ( ! empty( $background ) && '#ffffff' != $background ) {
$css .= '#top-bar-wrap,.oceanwp-top-bar-sticky{background-color:'. $background .';}';
}
// Top bar border color
if ( ! empty( $border_color ) && '#f1f1f1' != $border_color ) {
$css .= '#top-bar-wrap{border-color:'. $border_color .';}';
}
// Top bar text color
if ( ! empty( $text_color ) && '#929292' != $text_color ) {
$css .= '#top-bar-wrap,#top-bar-content strong{color:'. $text_color .';}';
}
// Top bar link color
if ( ! empty( $link_color ) && '#555555' != $link_color ) {
$css .= '#top-bar-content a,#top-bar-social-alt a{color:'. $link_color .';}';
}
// Top bar link color hover
if ( ! empty( $link_color_hover ) && '#13aff0' != $link_color_hover ) {
$css .= '#top-bar-content a:hover,#top-bar-social-alt a:hover{color:'. $link_color_hover .';}';
}
// Add top bar social font size
if ( ! empty( $social_font_size ) && '14' != $social_font_size ) {
$css .= '#top-bar-social li a{font-size:'. $social_font_size .'px;}';
}
// Add top bar social tablet font size
if ( ! empty( $social_tablet_font_size ) ) {
$css .= '@media (max-width: 768px){#top-bar-social li a{font-size:'. $social_tablet_font_size .'px;}}';
}
// Add top bar social mobile font size
if ( ! empty( $social_mobile_font_size ) ) {
$css .= '@media (max-width: 480px){#top-bar-social li a{font-size:'. $social_mobile_font_size .'px;}}';
}
// Top bar padding
if ( isset( $social_right_padding ) && '6' != $social_right_padding && '' != $social_right_padding
|| isset( $social_left_padding ) && '6' != $social_left_padding && '' != $social_left_padding ) {
$css .= '#top-bar-social li a{padding:'. oceanwp_spacing_css( '', $social_right_padding, '', $social_left_padding ) .'}';
}
// Tablet top bar padding
if ( isset( $social_tablet_right_padding ) && '' != $social_tablet_right_padding
|| isset( $social_tablet_left_padding ) && '' != $social_tablet_left_padding ) {
$css .= '@media (max-width: 768px){#top-bar-social li a{padding:'. oceanwp_spacing_css( '', $social_tablet_right_padding, '', $social_tablet_left_padding ) .'}}';
}
// Mobile top bar padding
if ( isset( $social_mobile_right_padding ) && '' != $social_mobile_right_padding
|| isset( $social_mobile_left_padding ) && '' != $social_mobile_left_padding ) {
$css .= '@media (max-width: 480px){#top-bar-social li a{padding:'. oceanwp_spacing_css( '', $social_mobile_right_padding, '', $social_mobile_left_padding ) .'}}';
}
// Top bar social link color
if ( ! empty( $social_links_color ) && '#bbbbbb' != $social_links_color ) {
$css .= '#top-bar-social li a{color:'. $social_links_color .';}';
}
// Top bar social link color hover
if ( ! empty( $social_hover_links_color ) ) {
$css .= '#top-bar-social li a:hover{color:'. $social_hover_links_color .'!important;}';
}
// Return CSS
if ( ! empty( $css ) ) {
$output .= '/* Top Bar CSS */'. $css;
}
// Return output css
return $output;
}
}
endif;
return new OceanWP_Top_Bar_Customizer();
@@ -0,0 +1,888 @@
<?php
/**
* Typography Customizer Options
*
* @package OceanWP WordPress theme
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'OceanWP_Typography_Customizer' ) ) :
class OceanWP_Typography_Customizer {
/**
* Setup class.
*
* @since 1.0
*/
public function __construct() {
add_action( 'customize_register', array( $this, 'customizer_options' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'load_fonts' ) );
// CSS output
if ( is_customize_preview() ) {
add_action( 'customize_preview_init', array( $this, 'customize_preview_init' ) );
add_action( 'wp_head', array( $this, 'live_preview_styles' ), 999 );
} else {
add_filter( 'ocean_head_css', array( $this, 'head_css' ), 99 );
}
}
/**
* Array of Typography settings to add to the customizer
*
* @since 1.0.0
*/
public function elements() {
// Return settings
return apply_filters( 'ocean_typography_settings', array(
'body' => array(
'label' => esc_html__( 'Body', 'oceanwp' ),
'target' => 'body',
'defaults' => array(
'font-size' => '14px',
'color' => '#929292',
'line-height' => '1.8',
),
),
'headings' => array(
'label' => esc_html__( 'All Headings', 'oceanwp' ),
'target' => 'h1,h2,h3,h4,h5,h6,.theme-heading,.widget-title,.oceanwp-widget-recent-posts-title,.comment-reply-title,.entry-title,.sidebar-box .widget-title',
'exclude' => array( 'font-size' ),
'defaults' => array(
'color' => '#333333',
'line-height' => '1.4',
),
),
'heading_h1' => array(
'label' => esc_html__( 'Heading 1 (H1)', 'oceanwp' ),
'target' => 'h1',
'defaults' => array(
'font-size' => '23px',
'color' => '#333333',
'line-height' => '1.4',
),
),
'heading_h2' => array(
'label' => esc_html__( 'Heading 2 (H2)', 'oceanwp' ),
'target' => 'h2',
'defaults' => array(
'font-size' => '20px',
'color' => '#333333',
'line-height' => '1.4',
),
),
'heading_h3' => array(
'label' => esc_html__( 'Heading 3 (H3)', 'oceanwp' ),
'target' => 'h3',
'defaults' => array(
'font-size' => '18px',
'color' => '#333333',
'line-height' => '1.4',
),
),
'heading_h4' => array(
'label' => esc_html__( 'Heading 4 (H4)', 'oceanwp' ),
'target' => 'h4',
'defaults' => array(
'font-size' => '17px',
'color' => '#333333',
'line-height' => '1.4',
),
),
'logo' => array(
'label' => esc_html__( 'Logo', 'oceanwp' ),
'target' => '#site-logo a.site-logo-text',
'exclude' => array( 'font-color' ),
'defaults' => array(
'font-size' => '24px',
'line-height' => '1.8',
),
),
'top_menu' => array(
'label' => esc_html__( 'Top Bar', 'oceanwp' ),
'target' => '#top-bar-content,#top-bar-social-alt',
'exclude' => array( 'font-color' ),
'defaults' => array(
'font-size' => '12px',
'line-height' => '1.8',
),
'active_callback' => 'oceanwp_cac_has_topbar',
),
'menu' => array(
'label' => esc_html__( 'Main Menu', 'oceanwp' ),
'target' => '#site-navigation-wrap .dropdown-menu > li > a,#site-header.full_screen-header .fs-dropdown-menu > li > a,#site-header.top-header #site-navigation-wrap .dropdown-menu > li > a,#site-header.center-header #site-navigation-wrap .dropdown-menu > li > a,#site-header.medium-header #site-navigation-wrap .dropdown-menu > li > a,.oceanwp-mobile-menu-icon a',
'exclude' => array( 'font-color', 'line-height' ),
'defaults' => array(
'font-size' => '13px',
'letter-spacing' => '0.6',
),
),
'menu_dropdown' => array(
'label' => esc_html__( 'Main Menu: Dropdowns', 'oceanwp' ),
'target' => '.dropdown-menu ul li a.menu-link,#site-header.full_screen-header .fs-dropdown-menu ul.sub-menu li a',
'exclude' => array( 'font-color' ),
'defaults' => array(
'font-size' => '12px',
'line-height' => '1.2',
'letter-spacing' => '0.6',
),
),
'mobile_menu_dropdown' => array(
'label' => esc_html__( 'Mobile Menu', 'oceanwp' ),
'target' => '.sidr-class-dropdown-menu li a, a.sidr-class-toggle-sidr-close, #mobile-dropdown ul li a, body #mobile-fullscreen ul li a',
'exclude' => array( 'font-color' ),
'defaults' => array(
'font-size' => '15px',
'line-height' => '1.8',
),
),
'page_title' => array(
'label' => esc_html__( 'Page Title', 'oceanwp' ),
'target' => '.page-header .page-header-title, .page-header.background-image-page-header .page-header-title',
'exclude' => array( 'font-color' ),
'defaults' => array(
'font-size' => '32px',
'line-height' => '1.4',
),
'active_callback' => 'oceanwp_cac_has_page_header',
),
'page_subheading' => array(
'label' => esc_html__( 'Page Title Subheading', 'oceanwp' ),
'target' => '.page-header .page-subheading',
'defaults' => array(
'font-size' => '15px',
'color' => '#929292',
'line-height' => '1.8',
),
'active_callback' => 'oceanwp_cac_has_page_header',
),
'breadcrumbs' => array(
'label' => esc_html__( 'Breadcrumbs', 'oceanwp' ),
'target' => '.site-breadcrumbs',
'exclude' => array( 'font-color', 'line-height' ),
'defaults' => array(
'font-size' => '13px',
),
'active_callback' => 'oceanwp_cac_has_breadcrumbs',
),
'blog_entry_title' => array(
'label' => esc_html__( 'Blog Entry Title', 'oceanwp' ),
'target' => '.blog-entry.post .blog-entry-header .entry-title a',
'defaults' => array(
'font-size' => '24px',
'color' => '#333333',
'line-height' => '1.4',
),
),
'blog_post_title' => array(
'label' => esc_html__( 'Blog Post Title', 'oceanwp' ),
'target' => '.single-post .entry-title',
'defaults' => array(
'font-size' => '34px',
'color' => '#333333',
'line-height' => '1.4',
'letter-spacing' => '0.6',
),
),
'sidebar_widget_title' => array(
'label' => esc_html__( 'Sidebar Widget Heading', 'oceanwp' ),
'target' => '.sidebar-box .widget-title',
'defaults' => array(
'font-size' => '13px',
'color' => '#333333',
'line-height' => '1',
'letter-spacing' => '1',
),
),
'widgets' => array(
'label' => esc_html__( 'Widgets', 'oceanwp' ),
'target' => '.sidebar-box, .footer-box',
),
'footer_widget_title' => array(
'label' => esc_html__( 'Footer Widget Heading', 'oceanwp' ),
'target' => '#footer-widgets .footer-box .widget-title',
'defaults' => array(
'font-size' => '13px',
'color' => '#ffffff',
'line-height' => '1',
'letter-spacing' => '1',
),
'active_callback' => 'oceanwp_cac_has_footer_widgets',
),
'copyright' => array(
'label' => esc_html__( 'Footer Copyright', 'oceanwp' ),
'target' => '#footer-bottom #copyright',
'exclude' => array( 'font-color' ),
'defaults' => array(
'font-size' => '12px',
'line-height' => '1',
),
'active_callback' => 'oceanwp_cac_has_footer_bottom',
),
'footer_menu' => array(
'label' => esc_html__( 'Footer Menu', 'oceanwp' ),
'target' => '#footer-bottom #footer-bottom-menu',
'exclude' => array( 'font-color' ),
'defaults' => array(
'font-size' => '12px',
'line-height' => '1',
),
'active_callback' => 'oceanwp_cac_has_footer_bottom',
),
) );
}
/**
* Customizer options
*
* @since 1.0.0
*/
public function customizer_options( $wp_customize ) {
// Get elements
$elements = self::elements();
// Return if elements are empty
if ( empty( $elements ) ) {
return;
}
// Panel
$wp_customize->add_panel( 'ocean_typography_panel' , array(
'title' => esc_html__( 'Typography', 'oceanwp' ),
'priority' => 210,
) );
/**
* Section
*/
$wp_customize->add_section( 'ocean_typography_general' , array(
'title' => esc_html__( 'General', 'oceanwp' ),
'priority' => 1,
'panel' => 'ocean_typography_panel',
) );
/**
* Disable Google Fonts
*/
$wp_customize->add_setting( 'ocean_disable_google_font', array(
'transport' => 'postMessage',
'default' => false,
'sanitize_callback' => 'oceanwp_sanitize_checkbox',
) );
$wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'ocean_disable_google_font', array(
'label' => esc_html__( 'Disable Google Fonts', 'oceanwp' ),
'type' => 'checkbox',
'section' => 'ocean_typography_general',
'settings' => 'ocean_disable_google_font',
'priority' => 10,
) ) );
/**
* Font Subsets
*/
$wp_customize->add_setting( 'ocean_google_font_subsets' , array(
'default' => array( 'latin' ),
'sanitize_callback' => 'oceanwp_sanitize_multicheck',
) );
$wp_customize->add_control( new OceanWP_Customize_Multicheck_Control( $wp_customize, 'ocean_google_font_subsets', array(
'label' => esc_html__( 'Font Subsets', 'oceanwp' ),
'section' => 'ocean_typography_general',
'settings' => 'ocean_google_font_subsets',
'priority' => 10,
'choices' => array(
'latin' => 'latin',
'latin-ext' => 'latin-ext',
'cyrillic' => 'cyrillic',
'cyrillic-ext' => 'cyrillic-ext',
'greek' => 'greek',
'greek-ext' => 'greek-ext',
'vietnamese' => 'vietnamese',
),
) ) );
// Lopp through elements
$count = '1';
foreach( $elements as $element => $array ) {
$count++;
// Get label
$label = ! empty( $array['label'] ) ? $array['label'] : null;
$exclude_attributes = ! empty( $array['exclude'] ) ? $array['exclude'] : false;
$active_callback = isset( $array['active_callback'] ) ? $array['active_callback'] : null;
$transport = 'postMessage';
// Get attributes
if ( ! empty ( $array['attributes'] ) ) {
$attributes = $array['attributes'];
} else {
$attributes = array(
'font-family',
'font-weight',
'font-style',
'text-transform',
'font-size',
'line-height',
'letter-spacing',
'font-color',
);
}
// Set keys equal to vals
$attributes = array_combine( $attributes, $attributes );
// Exclude attributes for specific options
if ( $exclude_attributes ) {
foreach ( $exclude_attributes as $key => $val ) {
unset( $attributes[ $val ] );
}
}
// Register new setting if label isn't empty
if ( $label ) {
/**
* Section
*/
$wp_customize->add_section( 'ocean_typography_'. $element , array(
'title' => $label,
'priority' => $count,
'panel' => 'ocean_typography_panel',
) );
/**
* Font Family
*/
if ( in_array( 'font-family', $attributes ) ) {
$wp_customize->add_setting( $element .'_typography[font-family]', array(
'type' => 'theme_mod',
'transport' => $transport,
'sanitize_callback' => 'sanitize_text_field',
) );
$wp_customize->add_control( new OceanWP_Customizer_Typography_Control( $wp_customize, $element .'_typography[font-family]', array(
'label' => esc_html__( 'Font Family', 'oceanwp' ),
'section' => 'ocean_typography_'. $element,
'settings' => $element .'_typography[font-family]',
'priority' => 10,
'type' => 'select',
'active_callback' => $active_callback,
) ) );
}
/**
* Font Weight
*/
if ( in_array( 'font-weight', $attributes ) ) {
$wp_customize->add_setting( $element .'_typography[font-weight]', array(
'type' => 'theme_mod',
'sanitize_callback' => 'oceanwp_sanitize_select',
'transport' => $transport,
) );
$wp_customize->add_control( $element .'_typography[font-weight]', array(
'label' => esc_html__( 'Font Weight', 'oceanwp' ),
'description' => esc_html__( 'Important: Not all fonts support every font-weight.', 'oceanwp' ),
'section' => 'ocean_typography_'. $element,
'settings' => $element .'_typography[font-weight]',
'priority' => 10,
'type' => 'select',
'active_callback' => $active_callback,
'choices' => array(
'' => esc_html__( 'Default', 'oceanwp' ),
'100' => esc_html__( 'Thin: 100', 'oceanwp' ),
'200' => esc_html__( 'Light: 200', 'oceanwp' ),
'300' => esc_html__( 'Book: 300', 'oceanwp' ),
'400' => esc_html__( 'Normal: 400', 'oceanwp' ),
'500' => esc_html__( 'Medium: 500', 'oceanwp' ),
'600' => esc_html__( 'Semibold: 600', 'oceanwp' ),
'700' => esc_html__( 'Bold: 700', 'oceanwp' ),
'800' => esc_html__( 'Extra Bold: 800', 'oceanwp' ),
'900' => esc_html__( 'Black: 900', 'oceanwp' ),
),
) );
}
/**
* Font Style
*/
if ( in_array( 'font-style', $attributes ) ) {
$wp_customize->add_setting( $element .'_typography[font-style]', array(
'type' => 'theme_mod',
'sanitize_callback' => 'oceanwp_sanitize_select',
'transport' => $transport,
) );
$wp_customize->add_control( $element .'_typography[font-style]', array(
'label' => esc_html__( 'Font Style', 'oceanwp' ),
'section' => 'ocean_typography_'. $element,
'settings' => $element .'_typography[font-style]',
'priority' => 10,
'type' => 'select',
'active_callback' => $active_callback,
'choices' => array(
'' => esc_html__( 'Default', 'oceanwp' ),
'normal' => esc_html__( 'Normal', 'oceanwp' ),
'italic' => esc_html__( 'Italic', 'oceanwp' ),
),
) );
}
/**
* Text Transform
*/
if ( in_array( 'text-transform', $attributes ) ) {
$wp_customize->add_setting( $element .'_typography[text-transform]', array(
'type' => 'theme_mod',
'sanitize_callback' => 'oceanwp_sanitize_select',
'transport' => $transport,
) );
$wp_customize->add_control( $element .'_typography[text-transform]', array(
'label' => esc_html__( 'Text Transform', 'oceanwp' ),
'section' => 'ocean_typography_'. $element,
'settings' => $element .'_typography[text-transform]',
'priority' => 10,
'type' => 'select',
'active_callback' => $active_callback,
'choices' => array(
'' => esc_html__( 'Default', 'oceanwp' ),
'capitalize' => esc_html__( 'Capitalize', 'oceanwp' ),
'lowercase' => esc_html__( 'Lowercase', 'oceanwp' ),
'uppercase' => esc_html__( 'Uppercase', 'oceanwp' ),
'none' => esc_html__( 'None', 'oceanwp' ),
),
) );
}
/**
* Font Size
*/
if ( in_array( 'font-size', $attributes ) ) {
// Get default
$default = ! empty( $array['defaults']['font-size'] ) ? $array['defaults']['font-size'] : NULL;
$wp_customize->add_setting( $element .'_typography[font-size]', array(
'type' => 'theme_mod',
'sanitize_callback' => 'sanitize_text_field',
'transport' => $transport,
'default' => $default,
) );
$wp_customize->add_setting( $element .'_tablet_typography[font-size]', array(
'transport' => $transport,
'sanitize_callback' => 'sanitize_text_field',
) );
$wp_customize->add_setting( $element .'_mobile_typography[font-size]', array(
'transport' => $transport,
'sanitize_callback' => 'sanitize_text_field',
) );
$wp_customize->add_control( new OceanWP_Customizer_Text_Control( $wp_customize, $element .'_typography[font-size]', array(
'label' => esc_html__( 'Font Size', 'oceanwp' ),
'description' => esc_html__( 'You can add: px-em-%', 'oceanwp' ),
'section' => 'ocean_typography_'. $element,
'settings' => array(
'desktop' => $element .'_typography[font-size]',
'tablet' => $element .'_tablet_typography[font-size]',
'mobile' => $element .'_mobile_typography[font-size]',
),
'priority' => 10,
'active_callback' => $active_callback,
) ) );
}
/**
* Line Height
*/
if ( in_array( 'line-height', $attributes ) ) {
// Get default
$default = ! empty( $array['defaults']['line-height'] ) ? $array['defaults']['line-height'] : NULL;
$wp_customize->add_setting( $element .'_typography[line-height]', array(
'type' => 'theme_mod',
'sanitize_callback' => 'oceanwp_sanitize_number',
'transport' => $transport,
'default' => $default,
) );
$wp_customize->add_setting( $element .'_tablet_typography[line-height]', array(
'transport' => $transport,
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( $element .'_mobile_typography[line-height]', array(
'transport' => $transport,
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_control( new OceanWP_Customizer_Slider_Control( $wp_customize, $element .'_typography[line-height]', array(
'label' => esc_html__( 'Line Height', 'oceanwp' ),
'section' => 'ocean_typography_'. $element,
'settings' => array(
'desktop' => $element .'_typography[line-height]',
'tablet' => $element .'_tablet_typography[line-height]',
'mobile' => $element .'_mobile_typography[line-height]',
),
'priority' => 10,
'active_callback' => $active_callback,
'input_attrs' => array(
'min' => 0,
'max' => 4,
'step' => 0.1,
),
) ) );
}
/**
* Letter Spacing
*/
if ( in_array( 'letter-spacing', $attributes ) ) {
// Get default
$default = ! empty( $array['defaults']['letter-spacing'] ) ? $array['defaults']['letter-spacing'] : NULL;
$wp_customize->add_setting( $element .'_typography[letter-spacing]', array(
'type' => 'theme_mod',
'sanitize_callback' => 'oceanwp_sanitize_number',
'transport' => $transport,
'default' => $default,
) );
$wp_customize->add_setting( $element .'_tablet_typography[letter-spacing]', array(
'transport' => $transport,
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_setting( $element .'_mobile_typography[letter-spacing]', array(
'transport' => $transport,
'sanitize_callback' => 'oceanwp_sanitize_number_blank',
) );
$wp_customize->add_control( new OceanWP_Customizer_Slider_Control( $wp_customize, $element .'_typography[letter-spacing]', array(
'label' => esc_html__( 'Letter Spacing (px)', 'oceanwp' ),
'section' => 'ocean_typography_'. $element,
'settings' => array(
'desktop' => $element .'_typography[letter-spacing]',
'tablet' => $element .'_tablet_typography[letter-spacing]',
'mobile' => $element .'_mobile_typography[letter-spacing]',
),
'priority' => 10,
'active_callback' => $active_callback,
'input_attrs' => array(
'min' => 0,
'max' => 10,
'step' => 0.1,
),
) ) );
}
/**
* Font Color
*/
if ( in_array( 'font-color', $attributes ) ) {
// Get default
$default = ! empty( $array['defaults']['color'] ) ? $array['defaults']['color'] : NULL;
$wp_customize->add_setting( $element .'_typography[color]', array(
'type' => 'theme_mod',
'default' => '',
'sanitize_callback' => 'oceanwp_sanitize_color',
'transport' => $transport,
'default' => $default,
) );
$wp_customize->add_control( new OceanWP_Customizer_Color_Control( $wp_customize, $element .'_typography[color]', array(
'label' => esc_html__( 'Font Color', 'oceanwp' ),
'section' => 'ocean_typography_'. $element,
'settings' => $element .'_typography[color]',
'priority' => 10,
'active_callback' => $active_callback,
) ) );
}
}
}
}
/**
* Loads js file for customizer preview
*
* @since 1.0.0
*/
public function customize_preview_init() {
wp_enqueue_script( 'oceanwp-typography-customize-preview', OCEANWP_INC_DIR_URI . 'customizer/assets/js/typography-customize-preview.min.js', array( 'customize-preview' ), OCEANWP_THEME_VERSION, true );
wp_localize_script( 'oceanwp-typography-customize-preview', 'oceanwp', array(
'googleFontsUrl' => '//fonts.googleapis.com',
'googleFontsWeight' => '100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i',
) );
}
/**
* Loop through settings
*
* @since 1.0.0
*/
public function loop( $return = 'css' ) {
// Define Vars
$css = '';
$fonts = array();
$elements = self::elements();
$preview_styles = array();
// Loop through each elements that need typography styling applied to them
foreach( $elements as $element => $array ) {
// Add empty css var
$add_css = '';
$tablet_css = '';
$mobile_css = '';
// Get target and current mod
$target = isset( $array['target'] ) ? $array['target'] : '';
$get_mod = get_theme_mod( $element .'_typography' );
$tablet_get_mod = get_theme_mod( $element .'_tablet_typography' );
$mobile_get_mod = get_theme_mod( $element .'_mobile_typography' );
// Attributes to loop through
if ( ! empty( $array['attributes'] ) ) {
$attributes = $array['attributes'];
} else {
$attributes = array(
'font-family',
'font-weight',
'font-style',
'font-size',
'color',
'line-height',
'letter-spacing',
'text-transform',
);
}
// Loop through attributes
foreach ( $attributes as $attribute ) {
// Define val
$default = isset( $array['defaults'][$attribute] ) ? $array['defaults'][$attribute] : NULL;
$val = isset( $get_mod[$attribute] ) ? $get_mod[$attribute] : $default;
$tablet_val = isset( $tablet_get_mod[$attribute] ) ? $tablet_get_mod[$attribute] : '';
$mobile_val = isset( $mobile_get_mod[$attribute] ) ? $mobile_get_mod[$attribute] : '';
// If there is a value lets do something
if ( $val && $default != $val ) {
// Sanitize
$val = str_replace( '"', '', $val );
// Add px if font size or letter spacing
$px = '';
if ( ( 'font-size' == $attribute
&& is_numeric( $val ) )
|| 'letter-spacing' == $attribute ) {
$px = 'px';
}
// Add quotes around font-family && font family to scripts array
if ( 'font-family' == $attribute ) {
$fonts[] = $val;
// No brackets can be added as it cause issue with sans serif fonts
$val = $val;
}
// Add to inline CSS
if ( 'css' == $return ) {
$add_css .= $attribute .':'. $val . $px .';';
}
// Customizer styles need to be added for each attribute
elseif ( 'preview_styles' == $return ) {
$preview_styles['customizer-typography-'. $element .'-'. $attribute] = $target .'{'. $attribute .':'. $val . $px .';}';
}
}
// If there is a value lets do something
if ( $tablet_val
&& ( 'font-size' == $attribute
|| 'line-height' == $attribute
|| 'letter-spacing' == $attribute ) ) {
// Sanitize
$tablet_val = str_replace( '"', '', $tablet_val );
// Add px if font size or letter spacing
$px = '';
if ( ( 'font-size' == $attribute
&& is_numeric( $tablet_val ) )
|| 'letter-spacing' == $attribute ) {
$px = 'px';
}
// Add to inline CSS
if ( 'css' == $return ) {
$tablet_css .= $attribute .':'. $tablet_val . $px .';';
}
// Customizer styles need to be added for each attribute
elseif ( 'preview_styles' == $return ) {
$preview_styles['customizer-typography-'. $element .'-tablet-'. $attribute] = '@media (max-width: 768px){'. $target .'{'. $attribute .':'. $tablet_val . $px .';}}';
}
}
// If there is a value lets do something
if ( $mobile_val
&& ( 'font-size' == $attribute
|| 'line-height' == $attribute
|| 'letter-spacing' == $attribute ) ) {
// Sanitize
$mobile_val = str_replace( '"', '', $mobile_val );
// Add px if font size or letter spacing
$px = '';
if ( ( 'font-size' == $attribute
&& is_numeric( $mobile_val ) )
|| 'letter-spacing' == $attribute ) {
$px = 'px';
}
// Add to inline CSS
if ( 'css' == $return ) {
$mobile_css .= $attribute .':'. $mobile_val . $px .';';
}
// Customizer styles need to be added for each attribute
elseif ( 'preview_styles' == $return ) {
$preview_styles['customizer-typography-'. $element .'-mobile-'. $attribute] = '@media (max-width: 480px){'. $target .'{'. $attribute .':'. $mobile_val . $px .';}}';
}
}
}
// Front-end inline CSS
if ( $add_css && 'css' == $return ) {
$css .= $target .'{'. $add_css .'}';
}
// Front-end inline tablet CSS
if ( $tablet_css && 'css' == $return ) {
$css .= '@media (max-width: 768px){'. $target .'{'. $tablet_css .'}}';
}
// Front-end inline mobile CSS
if ( $mobile_css && 'css' == $return ) {
$css .= '@media (max-width: 480px){'. $target .'{'. $mobile_css .'}}';
}
}
// Return CSS
if ( 'css' == $return && ! empty( $css ) ) {
$css = '/* Typography CSS */'. $css;
return $css;
}
// Return styles
if ( 'preview_styles' == $return && ! empty( $preview_styles ) ) {
return $preview_styles;
}
// Return Fonts Array
if ( 'fonts' == $return && ! empty( $fonts ) ) {
return array_unique( $fonts );
}
}
/**
* Get CSS
*
* @since 1.0.0
*/
public function head_css( $output ) {
// Get CSS
$typography_css = self::loop( 'css' );
// Loop css
if ( $typography_css ) {
$output .= $typography_css;
}
// Return output css
return $output;
}
/**
* Returns correct CSS to output to wp_head
*
* @since 1.0.0
*/
public function live_preview_styles() {
$live_preview_styles = self::loop( 'preview_styles' );
if ( $live_preview_styles ) {
foreach ( $live_preview_styles as $key => $val ) {
if ( ! empty( $val ) ) {
echo '<style class="'. $key .'"> '. $val .'</style>';
}
}
}
}
/**
* Loads Google fonts
*
* @since 1.0.0
*/
public function load_fonts() {
// Get fonts
$fonts = self::loop( 'fonts' );
// Loop through and enqueue fonts
if ( ! empty( $fonts ) && is_array( $fonts ) ) {
foreach ( $fonts as $font ) {
oceanwp_enqueue_google_font( $font );
}
}
}
}
endif;
return new OceanWP_Typography_Customizer();
File diff suppressed because it is too large Load Diff