File: /home/zwafgyp/locationdebateau/wp-content/themes/my-listing-child/functions.php
<?php
// Enqueue child theme style.css
add_action( 'wp_enqueue_scripts', function () {
wp_enqueue_style( 'child-style', get_stylesheet_uri() );
if ( is_rtl() ) {
wp_enqueue_style( 'mylisting-rtl', get_template_directory_uri() . '/rtl.css', [], wp_get_theme()->get('Version') );
}
}, 500);
// Enqueue child theme menu-script.js
add_action('wp_enqueue_scripts', function () {
wp_enqueue_script( 'menu-script', get_template_directory_uri() . '-child/assets/js/menu-script.js', array( 'jquery' ), '1.0', true);
});
// Happy Coding :)
add_filter( 'acf/settings/show_admin', '__return_true', 50 );
// ACF Display WordPress Custom Fields
add_filter('acf/settings/remove_wp_meta_box', '__return_false');
// LIMIT IMAGE UPLOAD SIZE - OK fonctionne
function max_image_size( $file ) {
$size = $file['size'];
$size = $size / 1024;
$type = $file['type'];
$is_image = strpos( $type, 'image' ) !== false;
$limit = 1024;
$limit_output = '1MB';
if ( $is_image && $size > $limit ) {
$file['error'] = 'Les fichiers image doivent ĂȘtre plus petits que ' . $limit_output;
}//end if
return $file;
}//end max_image_size()
add_filter( 'wp_handle_upload_prefilter', 'max_image_size' );
add_filter( 'option_woocommerce_enable_signup_and_login_from_checkout', function() {
return 'no';
}, 99 );
add_filter( 'option_woocommerce_enable_guest_checkout', function() {
return 'no';
}, 99 );