ru-se.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

overlap.php (3043B)


      1 <?php
      2 
      3 
      4 add_action("materialis_header_background_overlay_settings", "materialis_front_page_header_overlap_options", 5, 5);
      5 
      6 function materialis_front_page_header_overlap_options($section, $prefix, $group, $inner, $priority)
      7 {
      8     if ($inner) {
      9         return;
     10     }
     11     $priority = 5;
     12     $prefix   = "header";
     13     $section  = "header_background_chooser";
     14     $group    = "";
     15 
     16     materialis_add_kirki_field(array(
     17         'type'      => 'checkbox',
     18         'settings'  => 'header_overlap',
     19         'label'     => esc_html__('Allow content to overlap header', 'materialis'),
     20         'default'   => true,
     21         'section'   => $section,
     22         'priority'  => $priority,
     23         'group'     => $group,
     24         'transport' => 'postMessage',
     25     ));
     26 
     27     materialis_add_kirki_field(array(
     28         'type'            => 'dimension',
     29         'settings'        => 'header_overlap_with',
     30         'label'           => esc_html__('Overlap with', 'materialis'),
     31         'default'         => '95px',
     32         'active_callback' => array(
     33             array(
     34                 "setting"  => "header_overlap",
     35                 "operator" => "==",
     36                 "value"    => true,
     37             ),
     38         ),
     39         'output'          => array(
     40             array(
     41                 "element"  => ".materialis-front-page.overlap-first-section .header-homepage",
     42                 'property' => 'padding-bottom',
     43                 'media_query'   => '@media (min-width: 768px)',
     44             ),
     45             array(
     46                 "element"       => ".materialis-front-page.overlap-first-section .page-content div[data-overlap]:first-of-type > div:not([class*=\"section-separator\"]) ",
     47                 'property'      => 'margin-top',
     48                 'value_pattern' => "-$",
     49                 'media_query'   => '@media (min-width: 768px)',
     50             ),
     51         ),
     52         'js_vars'         => array(
     53             array(
     54                 "element"  => ".materialis-front-page.overlap-first-section .header-homepage",
     55                 'property' => 'padding-bottom',
     56                 'function' => 'style',
     57                 'media_query'   => '@media (min-width: 768px)',
     58             ),
     59             array(
     60                 "element"       => ".materialis-front-page.overlap-first-section .page-content div[data-overlap]:first-of-type > div:not([class*=\"section-separator\"]) ",
     61                 'property'      => 'margin-top',
     62                 'value_pattern' => "-$",
     63                 'function'      => 'style',
     64                 'media_query'   => '@media (min-width: 768px)',
     65             ),
     66         ),
     67         'transport'       => 'postMessage',
     68         'section'         => $section,
     69         'priority'        => $priority,
     70         'group'           => $group,
     71     ));
     72 }
     73 
     74 add_filter('body_class', function ($classes) {
     75     $overlap_mod = get_theme_mod('header_overlap', true);
     76     if (1 == intval($overlap_mod)) {
     77         $classes[] = "overlap-first-section";
     78     }
     79 
     80     return $classes;
     81 
     82 });