- MU-plugin v1.2: transparent header overlay via position:absolute on homepage (Kadence Pro workaround), body_class filter at priority 999 to inject transparent-header class, Kadence footer removed via remove_action after_setup_theme - Fixed hero height to exactly 100svh/100vh, removed min-height overflow - Fixed bottom gap: content-area margin-bottom:0 on homepage - Removed boxed content styling on homepage (entry-content-wrap) - Created Sobre ACRIB page (ID 29) with 8-milestone vertical timeline (2018-2025) - Created Novedades page (ID 30) as WordPress blog posts index - Added Sobre ACRIB and Novedades to primary nav menu - Configured Polylang: es (default), ro, en languages - Fixed Polylang nav_menus option format (lang-keyed menu IDs) - Added Polylang language switcher to primary menu - Created RO (acasa) and EN (home-en) homepage stubs - Added translation locale files for all plugins and Kadence theme Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
141 lines
5.3 KiB
PHP
141 lines
5.3 KiB
PHP
<?php
|
|
/**
|
|
* ACRIB Core MU-Plugin
|
|
* Always-on: custom footer, security hardening, performance tweaks.
|
|
* @version 1.2
|
|
*/
|
|
|
|
// --- Remove Kadence default copyright footer ---
|
|
// template-hooks.php is included at the root of functions.php, so the action
|
|
// is added before after_setup_theme fires. Priority 999 removes it after.
|
|
add_action('after_setup_theme', function () {
|
|
remove_action('kadence_footer', 'Kadence\footer_markup');
|
|
remove_action('kadence_footer_html', 'Kadence\footer_html');
|
|
}, 999);
|
|
|
|
// --- Transparent header body class on homepage (Kadence Pro workaround) ---
|
|
// Kadence's layout/component.php adds non-transparent-header at priority 10.
|
|
// We run at 999 to remove it and add transparent-header (used by Kadence JS).
|
|
add_filter('body_class', function ($classes) {
|
|
if (is_front_page()) {
|
|
$classes = array_diff($classes, ['non-transparent-header', 'mobile-non-transparent-header']);
|
|
$classes[] = 'transparent-header';
|
|
$classes[] = 'mobile-transparent-header';
|
|
}
|
|
return $classes;
|
|
}, 999);
|
|
|
|
// --- Footer: bottom bar with legal links + Cloud Host credit ---
|
|
add_action('wp_footer', function () {
|
|
$year = date('Y');
|
|
$legal_url = home_url('/aviso-legal/');
|
|
$pp_url = home_url('/politica-privacidad/');
|
|
$cookie_url = home_url('/politica-cookies/');
|
|
?>
|
|
<div class="acrib-footer-bottom">
|
|
<div class="acrib-footer-bottom-inner">
|
|
<p class="acrib-footer-copyright">
|
|
© <?php echo $year; ?> <strong>ACRIB</strong> — Asociación Casa Românească de las Islas Baleares
|
|
</p>
|
|
<ul class="acrib-footer-legal-links">
|
|
<li><a href="<?php echo esc_url($legal_url); ?>">Aviso Legal</a></li>
|
|
<li><a href="<?php echo esc_url($pp_url); ?>">Privacidad</a></li>
|
|
<li><a href="<?php echo esc_url($cookie_url); ?>">Cookies</a></li>
|
|
</ul>
|
|
<p class="acrib-footer-hosted">
|
|
Hosted & Maintained by <a href="https://cloudhost.es" target="_blank" rel="noopener noreferrer">Cloud Host</a>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
}, 100);
|
|
|
|
// --- Security headers ---
|
|
add_action('send_headers', function () {
|
|
if (!is_admin()) {
|
|
header('X-Frame-Options: SAMEORIGIN');
|
|
header('X-Content-Type-Options: nosniff');
|
|
header('Referrer-Policy: strict-origin-when-cross-origin');
|
|
header('Permissions-Policy: camera=(), microphone=(), geolocation=()');
|
|
}
|
|
});
|
|
|
|
// --- Disable XML-RPC ---
|
|
add_filter('xmlrpc_enabled', '__return_false');
|
|
remove_action('wp_head', 'rsd_link');
|
|
remove_action('wp_head', 'wlwmanifest_link');
|
|
remove_action('wp_head', 'wp_generator');
|
|
remove_action('wp_head', 'wp_shortlink_wp_head');
|
|
|
|
// --- Disable REST API user enumeration ---
|
|
add_filter('rest_endpoints', function ($endpoints) {
|
|
unset($endpoints['/wp/v2/users'], $endpoints['/wp/v2/users/(?P<id>[\d]+)']);
|
|
return $endpoints;
|
|
});
|
|
|
|
// --- Disable emoji (reduces ~20KB page weight) ---
|
|
remove_action('wp_head', 'print_emoji_detection_script', 7);
|
|
remove_action('wp_print_styles', 'print_emoji_styles');
|
|
remove_action('admin_print_scripts', 'print_emoji_detection_script');
|
|
remove_action('admin_print_styles', 'print_emoji_styles');
|
|
remove_filter('the_content_feed', 'wp_staticize_emoji');
|
|
remove_filter('comment_text_rss', 'wp_staticize_emoji');
|
|
remove_filter('wp_mail', 'wp_staticize_emoji_for_email');
|
|
|
|
// --- Limit post revisions ---
|
|
if (!defined('WP_POST_REVISIONS')) {
|
|
define('WP_POST_REVISIONS', 3);
|
|
}
|
|
|
|
// --- Homepage: inject critical CSS fixes ---
|
|
add_action('wp_head', function () {
|
|
if (!is_front_page()) return;
|
|
echo '<style id="acrib-homepage-fixes">
|
|
/* ── Transparent header overlay on homepage ───────────────────────── */
|
|
/* Position header absolutely so it overlays the hero without pushing */
|
|
/* content down — this is the Kadence Pro "transparent header" effect. */
|
|
.home #masthead.site-header{
|
|
position:absolute;
|
|
top:0;left:0;right:0;
|
|
z-index:1000;
|
|
background:transparent!important;
|
|
box-shadow:none!important;
|
|
}
|
|
/* Remove the top padding/margin Kadence normally adds to offset the header */
|
|
.home .content-area,
|
|
.home .site-content,
|
|
.home #content{
|
|
margin-top:0!important;
|
|
padding-top:0!important;
|
|
}
|
|
/* Remove Kadence blank page-title section above hero (title:hide meta ignored) */
|
|
.home .entry-hero.page-hero-section{display:none!important}
|
|
/* Remove bottom margin that creates gap after the last section */
|
|
.home .content-area{margin-bottom:0!important}
|
|
/* Remove boxed content styling on homepage */
|
|
.home .entry-content-wrap{
|
|
padding:0!important;
|
|
box-shadow:none!important;
|
|
margin:0!important;
|
|
background:none!important;
|
|
}
|
|
/* ── Hero: fill exactly one viewport height ───────────────────────── */
|
|
.acrib-hero.wp-block-cover{
|
|
height:100svh!important;
|
|
height:100vh!important;
|
|
min-height:0!important;
|
|
}
|
|
/* Centre hero content; padding-top clears the overlaid header */
|
|
.acrib-hero .wp-block-cover__inner-container{
|
|
height:100%!important;
|
|
min-height:0!important;
|
|
display:flex!important;
|
|
flex-direction:column!important;
|
|
align-items:center!important;
|
|
justify-content:center!important;
|
|
padding:80px 2rem 3rem!important;
|
|
box-sizing:border-box!important;
|
|
}
|
|
</style>' . "\n";
|
|
}, 5);
|