Hallo zusammen,
ich würde gerne die Font preloading function in meine function.php einbauen. Ich benutze das Theme OceanWP und weiss nicht wo ich die Funktion da einbringen kann.
/** Head Font Preloading **/
function font_preloading_preload_key_requests() { ?>
<link rel="preload" as="font" type="font/woff2" href="/wp-content/plugins/elementor/assets/lib/font-awesome/webfonts/fa-regular-400.woff2" crossorigin="anonymous">
<link rel="preload" as="font" type="font/woff2" href="wp-content/plugins/elementor/assets/lib/font-awesome/webfonts/fa-solid-900.woff2
" crossorigin="anonymous">
<link rel="preload" as="font" type="font/woff2" href="wp-content/plugins/elementor/assets/lib/eicons/fonts/eicons.woff2?5.9.1" crossorigin="anonymous">
add_action( 'wp_head', 'font_preloading_preload_key_requests' );
Diese Funktion würde ich nun gerne in die function.php einbauen, aber weiß nicht wo ich das machen soll. Kann mir jemand vielleicht kurz aufzeigen an welcher Stelle ich die Preloading function einbauen kann. Am Anfang und am Ende habe ich bereits versucht und es hat nicht funktioniert. Vieeeeelen Dank im Voraus.
<?php
/**
* Theme functions and definitions.
*
* Sets up the theme and provides some helper functions
*
* When using a child theme (see http://codex.wordpress.org/Theme_Development
* and http://codex.wordpress.org/Child_Themes), you can override certain
* functions (those wrapped in a function_exists() call) by defining them first
* in your child theme's functions.php file. The child theme's functions.php
* file is included before the parent theme's file, so the child theme
* functions would be used.
*
*
* For more information on hooks, actions, and filters,
* see http://codex.wordpress.org/Plugin_API
*
* @package OceanWP WordPress theme
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// Core Constants.
define( 'OCEANWP_THEME_DIR', get_template_directory() );
define( 'OCEANWP_THEME_URI', get_template_directory_uri() );
/**
* OceanWP theme class
*/
final class OCEANWP_Theme_Class {
/**
* Main Theme Class Constructor
*
* @since 1.0.0
*/
public function __construct() {
ab hier kommt noch gaanz viel mehr code... den lasse ich weg