'title',
'top_categories',
'products_carousel',
'featured_categories',
'other_categories',
'breadcrumb'
),
'section' => $layout['section'],
'priority' => 70,
'description' => esc_html__( 'Select which elements you want to show.', 'martfury' ),
'choices' => array(
'title' => esc_html__( 'Page Title', 'martfury' ),
'breadcrumb' => esc_html__( 'Breadcrumb', 'martfury' ),
'top_categories' => esc_html__( 'Top Categories', 'martfury' ),
'products_carousel' => esc_html__( 'Products Carousel', 'martfury' ),
'featured_categories' => esc_html__( 'Featured Categories', 'martfury' ),
'other_categories' => esc_html__( 'Other Categories', 'martfury' ),
),
'active_callback' => array(
array(
'setting' => $layout['field'] . '_layout',
'operator' => '==',
'value' => '2',
),
),
);
$catalog_fields[ $layout['field'] . '_els_3' ] = array(
'type' => 'multicheck',
'label' => $layout['label'] . ' ' . esc_html__( 'Elements', 'martfury' ),
'default' => array( 'title', 'banners', 'products_carousel', 'breadcrumb' ),
'section' => $layout['section'],
'priority' => 70,
'description' => esc_html__( 'Select which elements you want to show.', 'martfury' ),
'choices' => array(
'title' => esc_html__( 'Page Title', 'martfury' ),
'breadcrumb' => esc_html__( 'Breadcrumb', 'martfury' ),
'banners' => esc_html__( 'Banners', 'martfury' ),
'products_carousel' => esc_html__( 'Products Carousel', 'martfury' ),
),
'active_callback' => array(
array(
'setting' => $layout['field'] . '_layout',
'operator' => '==',
'value' => '3',
),
),
);
$catalog_fields[ $layout['field'] . 'custom' ] = array(
'type' => 'custom',
'default' => '
',
'section' => $layout['section'],
'priority' => 70,
);
}
$catalog_fields['products_cat_level_1_els_10'] = array(
'type' => 'multicheck',
'label' => esc_html__( 'Category Layout Elements', 'martfury' ),
'default' => array( 'breadcrumb' ),
'section' => 'product_cat_level_1_page',
'priority' => 70,
'description' => esc_html__( 'Select which elements you want to show.', 'martfury' ),
'choices' => array(
'title' => esc_html__( 'Page Title', 'martfury' ),
'breadcrumb' => esc_html__( 'Breadcrumb', 'martfury' ),
'banners' => esc_html__( 'Banners', 'martfury' ),
),
'active_callback' => array(
array(
'setting' => 'products_cat_level_1_layout',
'operator' => '==',
'value' => '10',
),
),
);
$fields = array_merge( $fields, $catalog_fields );
if ( did_action( 'elementor/loaded' ) ) {
$fields = array_merge(
$fields, array(
// Other Catlog
'elementor_columns_space' => array(
'type' => 'toggle',
'label' => esc_html__( 'Remove Default Columns Space', 'martfury' ),
'section' => 'elementor',
'default' => 1,
'priority' => 90,
'description' => esc_html__( 'Check this option to remove the default padding top, padding bottom of columns', 'martfury' ),
),
)
);
}
$settings['panels'] = apply_filters( 'martfury_customize_panels', $panels );
$settings['sections'] = apply_filters( 'martfury_customize_sections', $sections );
$settings['fields'] = apply_filters( 'martfury_customize_fields', $fields );
return $settings;
}
$martfury_customize = new Martfury_Customize( martfury_customize_settings() );
// Fix downloaded fonts from Google.
if ( defined( 'KIRKI_VERSION' ) && version_compare( KIRKI_VERSION, '5.0.0', '<=' ) ) {
/**
* Change the http request headers of 'user-agent' to download .woff2 fonts frm Google.
*
* @param array $args
* @param string $url
*
* @return array
*/
function martfury_fix_kirki_fonts_request_headers( $args, $url ) {
if ( false === strpos( $url, 'https://fonts.googleapis.com/css' ) ) {
return $args;
}
if ( isset( $args['user-agent'] ) && $args['user-agent'] == 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.8' ) {
$args['user-agent'] = 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:73.0) Gecko/20100101 Firefox/73.0';
}
return $args;
}
add_filter( 'http_request_args', 'martfury_fix_kirki_fonts_request_headers', 10, 2 );
/**
* Fix incorrect fonts files downloaded from Google.
* Delete the Kirki's transients to force downloading font files again.
*
* @return void
*/
function martfury_fix_kirki_fonts() {
delete_transient( 'kirki_remote_url_contents' );
}
add_action( 'after_switch_theme', 'martfury_fix_kirki_fonts' );
add_action( 'wp_ajax_kirki_clear_font_cache', 'martfury_fix_kirki_fonts' );
}