feat: initial ACRIB WordPress deployment
- WordPress 6.9.4 (es_ES) with Kadence theme - Homepage: Hero, La Asociación, Pilares, Beneficios, Eventos, Miembros, Hazte Miembro, Contacto - Brand identity: #13294b navy, #a12932 burgundy, #c69c48 gold - Fonts: Raleway (headings) + Source Sans 3 (body) + Lato (UI) - Plugins: Kadence Blocks, Polylang, Contact Form 7 - Custom CSS with full brand styling and responsive layout - HTTPS enforced via wp-config.php proxy detection
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
<?php declare( strict_types=1 );
|
||||
|
||||
namespace KadenceWP\KadenceBlocks\Optimizer\Resource_Hints;
|
||||
|
||||
use KadenceWP\KadenceBlocks\Optimizer\Analysis_Registry;
|
||||
|
||||
/**
|
||||
* Adds the following to the frontend head section, to allow faster loading
|
||||
* Google Fonts:
|
||||
*
|
||||
* <link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
* <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
*/
|
||||
final class Google_Font_Preconnector {
|
||||
|
||||
public const PRECONNECT = 'preconnect';
|
||||
|
||||
private Analysis_Registry $registry;
|
||||
|
||||
public function __construct(
|
||||
Analysis_Registry $registry
|
||||
) {
|
||||
$this->registry = $registry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add preconnect links for Google Fonts. We actually have no way of knowing that Kadence is using
|
||||
* them as the style enqueuing happens later in the execution.
|
||||
*
|
||||
* @filter wp_resource_hints
|
||||
*
|
||||
* @param array<array|string> $urls Array of resources and their attributes, or URLs to print for resource hints.
|
||||
* @param string $relation_type The relation type the URLs are printed for. One of 'dns-prefetch', 'preconnect', 'prefetch', or 'prerender'.
|
||||
*
|
||||
* @return array<array|string>
|
||||
*/
|
||||
public function preconnect( array $urls, string $relation_type ): array {
|
||||
if ( ! $this->registry->is_optimized() ) {
|
||||
return $urls;
|
||||
}
|
||||
|
||||
if ( self::PRECONNECT !== $relation_type ) {
|
||||
return $urls;
|
||||
}
|
||||
|
||||
$urls[] = 'https://fonts.googleapis.com';
|
||||
$urls[] = [
|
||||
'href' => 'https://fonts.gstatic.com',
|
||||
true => 'crossorigin',
|
||||
];
|
||||
|
||||
return $urls;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php declare( strict_types=1 );
|
||||
|
||||
namespace KadenceWP\KadenceBlocks\Optimizer\Resource_Hints;
|
||||
|
||||
use KadenceWP\KadenceBlocks\StellarWP\ProphecyMonorepo\Container\Contracts\Provider as Provider_Contract;
|
||||
|
||||
final class Provider extends Provider_Contract {
|
||||
|
||||
public function register(): void {
|
||||
/**
|
||||
* Allow resource hints to be disabled.
|
||||
*
|
||||
* @param bool $enabled Whether this feature is enabled.
|
||||
*/
|
||||
$enabled = (bool) apply_filters( 'kadence_blocks_enable_resource_hits', true );
|
||||
|
||||
if ( ! $enabled ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->container->singleton( Google_Font_Preconnector::class, Google_Font_Preconnector::class );
|
||||
|
||||
add_filter(
|
||||
'wp_resource_hints',
|
||||
$this->container->callback( Google_Font_Preconnector::class, 'preconnect' ),
|
||||
10,
|
||||
2
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user