Site logo

[Resolved] Child theme – header.php – add fontawesome

Home Forums Support [Resolved] Child theme – header.php – add fontawesome

Home Forums Support Child theme – header.php – add fontawesome

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2069849
    Jens

    Hello,

    I try to add a css-file in my child theme header.php.

    My first question is, do I have to copy the original header.php into the child theme or does it have to be empty?

    The second question is how can I add the CSS file in the header and on which position?

    <link rel=”stylesheet” href=”/css/fontawesome/css/all.css”>

    Is there a rule in which directory the css data should be located? At the moment I puted it directly in the root of my project.

    Update:
    I just found under the folder “wp-content\themes\generatepress\assets\fonts\fontawesome-webfont.svg” that the font is already delivered with generatePress. Do I possibly no longer have to integrate it and can I use these files?

    Best regards
    Jens

    #2069916
    David
    Staff
    Customer Support

    Hi there,

    Ideally you should use the wp_enqueue_scripts and wp_enqueue_style functions to load a style sheet.
    Regarding your update – that is Legacy file when old versions of the theme used Font Awesome.

    Personally i would not recommend loading the CSS from the theme or your child theme for FA icons. The files it loads are huge and will tank your sites performance.

    If you must use FA Icons then better to use their plugin:

    https://wordpress.org/plugins/font-awesome/

    It has the option to use SVGs ( instead of WebFonts) which means it just loads the necessary SVG for the icons you choose and not the entire library….

    #2070227
    Jens

    Hi David,

    Thanks for your answer. In this case I use the plug-in. That seems to be the easiest way at the moment.

    Best regards
    Jens

    #2070961
    David
    Staff
    Customer Support

    You’re welcome

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.