Skip to content

Hooks—Theme Assets and Meta Tags

Jo Dickson edited this page Feb 19, 2021 · 3 revisions

Navigation

Filters


ucfwp_preload_font_awesome_fonts

Hook into this filter to modify the list of font files that should be preloaded in the document head when Font Awesome (version 4 or 5) is in use.

Note that only .woff2 files are supported for preloading (don't preload .woff files or other font file types).

Parameters

  • $fa_fonts array

    Array of font file URLs.

  • $fa_version string

    The current version of Font Awesome in use ("4", "5", "none")

Return

array: Array of font file URLs.


ucfwp_preload_athena_fallback_fonts

Hook into this filter to modify the list of font files that should be preloaded in the document head when Cloud.Typography is not in use.

Note that only .woff2 files are supported for preloading (don't preload .woff files or other font file types).

Parameters

  • $fallback_fonts array

    Array of font file URLs.

Return

array: Array of font file URLs.

Example usage

// Adds Athena's "condensed" fallback font to the list of fonts to preload
function preload_custom_fallback_fonts( $fallback_fonts ) {
    $fallback_fonts[] = UCFWP_THEME_FONT_URL . '/ucf-condensed-alt/ucfcondensedalt-regular-webfont.woff2';
    return $fallback_fonts;
}

add_action( 'ucfwp_preload_athena_fallback_fonts', 'preload_custom_fallback_fonts' );
Clone this wiki locally