Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add posibility to use rem, vw #144

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions includes/customizer/options/canvas.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@
'max' => 1600,
'step' => 1,
),
'vw' => array(
'min' => 1,
'max' => 100,
'step' => 0.01,
),
'rem' => array(
'min' => 0.01,
'max' => 100,
'step' => 0.01,
),
),
'priority' => 20,
) ) );
Expand All @@ -95,6 +105,16 @@
'max' => 1000,
'step' => 1,
),
'vw' => array(
'min' => 1,
'max' => 100,
'step' => 0.01,
),
'rem' => array(
'min' => 0.01,
'max' => 100,
'step' => 0.01,
),
),
'priority' => 20,
) ) );
Expand Down Expand Up @@ -129,6 +149,16 @@
'max' => 2000,
'step' => 1,
),
'vw' => array(
'min' => 1,
'max' => 100,
'step' => 0.01,
),
'rem' => array(
'min' => 0.01,
'max' => 100,
'step' => 0.01,
),
),
'priority' => 30,
) ) );
Expand Down
122 changes: 122 additions & 0 deletions includes/customizer/options/header--logo.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
* @package Suki
**/

// Prevent direct access.
if ( ! defined( 'ABSPATH' ) ) exit;<?php
/**
* Customizer settings: Header > Logo
*
* @package Suki
**/

// Prevent direct access.
if ( ! defined( 'ABSPATH' ) ) exit;

Expand Down Expand Up @@ -37,6 +45,120 @@
'priority' => 10,
) ) );

// Max width
$key = 'header_logo_width';
$wp_customize->add_setting( $key, array(
'default' => suki_array_value( $defaults, $key ),
'transport' => 'postMessage',
'sanitize_callback' => array( 'Suki_Customizer_Sanitization', 'dimension' ),
) );
$wp_customize->add_control( new Suki_Customize_Control_Dimension( $wp_customize, $key, array(
'section' => $section,
'label' => esc_html__( 'Max width', 'suki' ),
'units' => array(
'px' => array(
'min' => 0,
'step' => 1,
),
'vw' => array(
'min' => 1,
'max' => 100,
'step' => 0.01,
),
'rem' => array(
'min' => 0.01,
'max' => 100,
'step' => 0.01,
),
),
'priority' => 10,
) ) );

/**
* ====================================================
* Mobile Logo
* ====================================================
*/

// Heading: Mobile Logo
$wp_customize->add_control( new Suki_Customize_Control_Heading( $wp_customize, 'heading_header_mobile_logo', array(
'section' => $section,
'settings' => array(),
'label' => esc_html__( 'Mobile Logo', 'suki' ),
'priority' => 20,
) ) );

// Mobile Logo
$key = 'custom_logo_mobile';
$wp_customize->add_setting( $key, array(
'default' => suki_array_value( $defaults, $key ),
'sanitize_callback' => 'absint',
) );
$wp_customize->add_control( new WP_Customize_Media_Control( $wp_customize, $key, array(
'section' => $section,
'label' => esc_html__( 'Mobile logo image', 'suki' ),
'mime_type' => 'image',
'priority' => 20,
) ) );

// Max width
$key = 'header_mobile_logo_width';
$wp_customize->add_setting( $key, array(
'default' => suki_array_value( $defaults, $key ),
'transport' => 'postMessage',
'sanitize_callback' => array( 'Suki_Customizer_Sanitization', 'dimension' ),
) );
$wp_customize->add_control( new Suki_Customize_Control_Dimension( $wp_customize, $key, array(
'section' => $section,
'label' => esc_html__( 'Max width', 'suki' ),
'units' => array(
'px' => array(
'min' => 0,
'step' => 1,
),
'vw' => array(
'min' => 1,
'max' => 100,
'step' => 0.01,
),
'rem' => array(
'min' => 0.01,
'max' => 100,
'step' => 0.01,
),
),
'priority' => 20,
) ) );

$section = 'suki_section_header_logo';

/**
* ====================================================
* Desktop Logo
* ====================================================
*/

// Heading: Logo
$wp_customize->add_control( new Suki_Customize_Control_Heading( $wp_customize, 'heading_header_logo', array(
'section' => $section,
'settings' => array(),
'label' => esc_html__( 'Logo', 'suki' ),
'priority' => 10,
) ) );

// Logo
$key = 'custom_logo';
$wp_customize->add_setting( $key, array(
'default' => suki_array_value( $defaults, $key ),
'sanitize_callback' => 'absint',
) );
$wp_customize->add_control( new WP_Customize_Media_Control( $wp_customize, $key, array(
'section' => $section,
'label' => esc_html__( 'Logo image', 'suki' ),
'mime_type' => 'image',
'priority' => 10,
) ) );

// Max width
$key = 'header_logo_width';
$wp_customize->add_setting( $key, array(
Expand Down