Skip to content

Instantly share code, notes, and snippets.

@BoDonkey
Created May 8, 2018 20:38
Show Gist options
  • Save BoDonkey/c6a9701be26f6c17c383638ffb6b79ef to your computer and use it in GitHub Desktop.
Save BoDonkey/c6a9701be26f6c17c383638ffb6b79ef to your computer and use it in GitHub Desktop.
Responsive field code
//field
'horizontal_line_width' => array(
'label' => esc_html__('Horizontal Line Width', 'diti-divi-timeline'),
'type' => 'range',
'option_category' => 'layout',
'description' => esc_html__('Here you can set a width for the Horizontal Line.', 'diti-divi-timeline'),
'toggle_slug' => 'main_settings',
'mobile_options' => true,
'responsive' => true,
'default' => '3px',
'default_unit' => 'px',
'allow_empty' => true,
'range_settings' => array(
'min' => '1',
'max' => '20',
'step' => '1',
),
//render
$horizontal_line_width = $this->props['horizontal_line_width'];
$horizontal_line_width_tablet = $this->props['horizontal_line_width_tablet'];
$horizontal_line_width_phone = $this->props['horizontal_line_width_phone'];
$horizontal_line_width_last_edited = $this->props['horizontal_line_width_last_edited'];
if ( '' !== $horizontal_line_width || '' !== $horizontal_line_width_tablet || '' !== $horizontal_line_width_phone ) {
$line_width_responsive_active = et_pb_get_responsive_status( $horizontal_line_width_last_edited );
$line_width_values = array(
'desktop' => $horizontal_line_width,
'tablet' => $line_width_responsive_active ? $horizontal_line_width_tablet : '',
'phone' => $line_width_responsive_active ? $horizontal_line_width_phone : '',
);
et_pb_generate_responsive_css( $line_width_values, '%%order_class%% .timeline::before', 'width', $render_slug );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment