ru-se.com

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

options.php (8944B)


      1 <?php
      2 
      3 
      4 materialis_add_kirki_field(array(
      5     'type'     => 'sectionseparator',
      6     'label'    => esc_html__('Shop Page Settings', 'materialis'),
      7     'settings' => "woocommerce_shop_page_separator_options",
      8     'section'  => 'materialis_woocommerce_product_list',
      9     'priority' => '1',
     10 
     11 ));
     12 
     13 add_action('customize_register', 'materialis_add_shop_page_setting_options');
     14 
     15 function materialis_add_shop_page_setting_options()
     16 {
     17     do_action('materialis_customizer_prepend_woocommerce_list_options', 'materialis_woocommerce_product_list');
     18 }
     19 
     20 materialis_add_kirki_field(array(
     21     'type'     => 'number',
     22     'settings' => "woocommerce_products_per_page",
     23     'label'    => esc_html__('Products per page', 'materialis'),
     24     'section'  => 'materialis_woocommerce_product_list',
     25     'default'  => 12,
     26     'priority' => '10',
     27 ));
     28 
     29 materialis_add_kirki_field(array(
     30     'type'     => 'number',
     31     'settings' => "woocommerce_list_item_desktop_cols",
     32     'label'    => esc_html__('Products per row on desktop', 'materialis'),
     33     'section'  => 'materialis_woocommerce_product_list',
     34     'default'  => 4,
     35     'choices'  => array(
     36         'min'  => 2,
     37         'max'  => 8,
     38         'step' => 1,
     39     ),
     40     'priority' => '10',
     41 ));
     42 
     43 
     44 materialis_add_kirki_field(array(
     45     'type'     => 'number',
     46     'settings' => "woocommerce_list_item_tablet_cols",
     47     'label'    => esc_html__('Products per row on tablet', 'materialis'),
     48     'section'  => 'materialis_woocommerce_product_list',
     49     'default'  => 2,
     50     'choices'  => array(
     51         'min'  => 1,
     52         'max'  => 6,
     53         'step' => 1,
     54     ),
     55     'priority' => '10',
     56 ));
     57 
     58 
     59 materialis_add_kirki_field(array(
     60     'type'     => 'sectionseparator',
     61     'label'    => esc_html__('Related products Settings', 'materialis'),
     62     'settings' => "woocommerce_related_products_separator_options",
     63     'section'  => 'materialis_woocommerce_product_list',
     64     'priority' => '21',
     65 
     66 ));
     67 
     68 materialis_add_kirki_field(array(
     69     'type'      => 'number',
     70     'settings'  => "woocommerce_related_list_item_desktop_cols",
     71     'label'     => esc_html__('Related products per row on desktop', 'materialis'),
     72     'section'   => 'materialis_woocommerce_product_list',
     73     'default'   => 4,
     74     'choices'  => array(
     75         'min'  => 2,
     76         'max'  => 8,
     77         'step' => 1,
     78     ),
     79     'priority'  => '30',
     80 ));
     81 
     82 
     83 materialis_add_kirki_field(array(
     84     'type'     => 'number',
     85     'settings' => "woocommerce_related_list_item_tablet_cols",
     86     'label'    => esc_html__('Related products per row on tablet', 'materialis'),
     87     'section'  => 'materialis_woocommerce_product_list',
     88     'default'  => 2,
     89     'choices'  => array(
     90         'min'  => 2,
     91         'max'  => 6,
     92         'step' => 1,
     93     ),
     94     'priority' => '30',
     95 ));
     96 
     97 materialis_add_kirki_field(array(
     98     'type'     => 'sectionseparator',
     99     'label'    => esc_html__('Upsell products Settings', 'materialis'),
    100     'settings' => "woocommerce_up_sell_products_separator_options",
    101     'section'  => 'materialis_woocommerce_product_list',
    102     'priority' => '41',
    103 
    104 ));
    105 
    106 materialis_add_kirki_field(array(
    107     'type'     => 'ope-info',
    108     'label'    => esc_html__('The upsell product list appears in the product page, before the related products list', 'materialis'),
    109     'section'  => 'materialis_woocommerce_product_list',
    110     'settings' => "woocommerce_upsells_list_item_desktop_cols_info",
    111     'priority' => '50',
    112 ));
    113 
    114 materialis_add_kirki_field(array(
    115     'type'     => 'number',
    116     'settings' => "woocommerce_upsells_list_item_desktop_cols",
    117     'label'    => esc_html__('Upsell products per row on desktop', 'materialis'),
    118     'section'  => 'materialis_woocommerce_product_list',
    119     'default'  => 4,
    120     'choices'  => array(
    121         'min'  => 2,
    122         'max'  => 8,
    123         'step' => 1,
    124     ),
    125     'priority' => '50',
    126 ));
    127 
    128 materialis_add_kirki_field(array(
    129     'type'     => 'number',
    130     'settings' => "woocommerce_upsells_list_item_tablet_cols",
    131     'label'    => esc_html__('Upsell products per row on tablet', 'materialis'),
    132     'section'  => 'materialis_woocommerce_product_list',
    133     'default'  => 2,
    134     'choices'  => array(
    135         'min'  => 2,
    136         'max'  => 6,
    137         'step' => 1,
    138     ),
    139     'priority' => '50',
    140 ));
    141 
    142 materialis_add_kirki_field(array(
    143     'type'     => 'sectionseparator',
    144     'label'    => esc_html__('Cross-sell products Settings', 'materialis'),
    145     'settings' => "woocommerce_cross_sell_products_separator_options",
    146     'section'  => 'materialis_woocommerce_product_list',
    147     'priority' => '61',
    148 
    149 ));
    150 
    151 
    152 materialis_add_kirki_field(array(
    153     'type'     => 'ope-info',
    154     'label'    => esc_html__('The cross-sell product list appears in the shopping cart page', 'materialis'),
    155     'section'  => 'materialis_woocommerce_product_list',
    156     'settings' => "woocommerce_cross_sell_list_item_desktop_cols_info",
    157     'priority' => '70',
    158 ));
    159 
    160 
    161 materialis_add_kirki_field(array(
    162     'type'     => 'number',
    163     'settings' => "woocommerce_cross_sells_product_no",
    164     'label'    => esc_html__('Number of cross-sell products to display', 'materialis'),
    165     'section'  => 'materialis_woocommerce_product_list',
    166     'default'  => 2,
    167     'choices'  => array(
    168         'min'  => 0,
    169         'max'  => 50,
    170         'step' => 1,
    171     ),
    172     'priority' => '70',
    173 ));
    174 
    175 materialis_add_kirki_field(array(
    176     'type'     => 'number',
    177     'settings' => "woocommerce_cross_sell_list_item_desktop_cols",
    178     'label'    => esc_html__('Cross-sell products per row on desktop', 'materialis'),
    179     'section'  => 'materialis_woocommerce_product_list',
    180     'default'  => 2,
    181     'choices'  => array(
    182         'min'  => 2,
    183         'max'  => 8,
    184         'step' => 1,
    185     ),
    186     'priority' => '70',
    187 ));
    188 
    189 
    190 materialis_add_kirki_field(array(
    191     'type'     => 'number',
    192     'settings' => "woocommerce_cross_sell_list_item_tablet_cols",
    193     'label'    => esc_html__('Cross-sell products per row on tablet', 'materialis'),
    194     'section'  => 'materialis_woocommerce_product_list',
    195     'default'  => 2,
    196     'choices'  => array(
    197         'min'  => 2,
    198         'max'  => 6,
    199         'step' => 1,
    200     ),
    201     'priority' => '70',
    202 ));
    203 
    204 
    205 add_filter('cloudpress\customizer\global_data', function ($data) {
    206 
    207     $key = wp_create_nonce('materialis_woocommerce_api_nonce');
    208     set_theme_mod('materialis_woocommerce_api_nonce', $key);
    209 
    210     if ( ! isset($_REQUEST['materialis_woocommerce_api_nonce'])) {
    211         $data['materialis_woocommerce_api_nonce'] = $key;
    212     }
    213 
    214     return $data;
    215 });
    216 
    217 materialis_add_kirki_field(array(
    218     'type'     => 'sectionseparator',
    219     'label'    => esc_html__('Shop Header Settings', 'materialis'),
    220     'settings' => "woocommerce_shop_header_separator_options",
    221     'section'  => 'materialis_woocommerce_general_options',
    222 
    223 ));
    224 
    225 materialis_add_kirki_field(array(
    226     'type'     => 'checkbox',
    227     'settings' => 'woocommerce_cart_display_near_menu',
    228     'label'    => esc_html__('Show cart button in menu', 'materialis'),
    229     'section'  => 'materialis_woocommerce_general_options',
    230     'default'  => true,
    231 ));
    232 
    233 
    234 materialis_add_kirki_field(array(
    235     'type'     => 'select',
    236     'settings' => 'woocommerce_header_type',
    237     'label'    => esc_html__('Shop header', 'materialis'),
    238     'section'  => 'materialis_woocommerce_general_options',
    239     'default'  => 'default',
    240     'choices'  => apply_filters('materialis_woocommerce_shop_header_type_choices', array(
    241         "default" => esc_html__("Large header with title", "materialis"),
    242         "small"   => esc_html__("Navigation only", "materialis"),
    243     )),
    244 ));
    245 
    246 
    247 materialis_add_kirki_field(array(
    248     'type'     => 'select',
    249     'settings' => 'woocommerce_product_header_type',
    250     'label'    => esc_html__('Product detail header', 'materialis'),
    251     'section'  => 'materialis_woocommerce_general_options',
    252     'default'  => 'default',
    253     'choices'  => apply_filters('materialis_woocommerce_shop_header_type_choices', array(
    254         "default" => esc_html__("Large header with title", "materialis"),
    255         "small"   => esc_html__("Navigation only", "materialis"),
    256     )),
    257 ));
    258 
    259 
    260 materialis_add_kirki_field(array(
    261     'type'            => 'checkbox',
    262     'settings'        => 'woocommerce_product_header_image',
    263     'label'           => esc_html__('Set shop/product featured image as header background', 'materialis'),
    264     'description'     => esc_html__('Must have inner pages hero background set to image, and shop page and/or product featured image added.', 'materialis'),
    265     'section'         => 'materialis_woocommerce_general_options',
    266     'default'         => true,
    267     'active_callback' => array(
    268         array(
    269             'setting'  => 'woocommerce_product_header_type',
    270             'operator' => '!=',
    271             'value'    => 'small',
    272         ),
    273     ),
    274 ));
    275 
    276 
    277 add_filter("materialis_inner_header_background_type", function ($type) {
    278     if (materialis_is_woocommerce_product_page() && get_theme_mod("woocommerce_product_header_image", true)) {
    279         return "image";
    280     }
    281 
    282     return $type;
    283 }, 1);