<?php

add_action( 'wp_enqueue_scripts', 'porto_child_css', 1001 );

function porto_child_css() {

wp_deregister_style( 'styles-child' );
wp_register_style( 'styles-child', esc_url( get_stylesheet_directory_uri() ) . '/style.css' );
wp_enqueue_style( 'styles-child' );

if ( is_rtl() ) {
wp_deregister_style( 'styles-child-rtl' );
wp_register_style( 'styles-child-rtl', esc_url( get_stylesheet_directory_uri() ) . '/style_rtl.css' );
wp_enqueue_style( 'styles-child-rtl' );
}
}

add_action( 'admin_head', 'wpexpert_admin_css' );
function wpexpert_admin_css() {
echo '<style> #vc_license-activation-notice {display:none;} </style>';
}

////////////////////////////////////////////////////////////////////////////////////////////////////////

function remove_footer_admin () {
echo '<span id="footer-thankyou">Developed by <a href="https://enigmaweb.ch" target="_blank">ENIGMAweb.ch</a> für ENIGMA</span>';
}

add_filter('admin_footer_text', 'remove_footer_admin');

////////////////////////////////////////////////////////////////////////////////////////////////////////

add_action( 'after_setup_theme', function() {
add_image_size( 'woocommerce_gallery_thumbnail', 300, 300, false );
});
add_filter( 'woocommerce_get_image_size_gallery_thumbnail', function($size) {
return array(
'width'  => 300,
'height' => 300,
'crop'   => false,
);
});

////////////////////////////////////////////////////////////////////////////////////////////////////////

add_filter('site_status_tests', function ($tests) {
foreach (['direct', 'async'] as $group) {
if (isset($tests[$group]['page_cache'])) {
unset($tests[$group]['page_cache']);
}
if (isset($tests[$group]['autoloaded_options'])) {
unset($tests[$group]['autoloaded_options']);
}
}
return $tests;
}, 999);

////////////////////////////////////////////////////////////////////////////////////////////////////////

remove_action( 'send_headers', 'wp_send_frame_options_header' );
add_action('send_headers', function () {
header_remove('X-Frame-Options');
header_remove('Content-Security-Policy');
header("X-Frame-Options: SAMEORIGIN");
header("Content-Security-Policy: frame-ancestors 'self';");
});
