Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • in reply to: How to add Google Fonts to HEAD tag on website? #276901

    That works! Thank you Thank you! Thank you!

    If I wanted to add other CSS classes based on this font, would I just add it below the first class? For example:

    function avia_custom_css() {
    echo '<link href="http://fonts.googleapis.com/css?family=Alex+Brush" rel="stylesheet" type="text/css">';
        echo '<style>
    .fancy-1 {
        font-family:"Alex Brush", cursive;
        font-size: 2em;
    }
    .fancy-2 {
        font-family:"Alex Brush", cursive;
        font-size: 5em;
    </style>';
    }
    add_action('wp_head', 'avia_custom_css');
    • This reply was modified 10 years, 11 months ago by Geekcheck.
    in reply to: How to add Google Fonts to HEAD tag on website? #276884

    This partially works, but I think I may need to be more clear in my explanation. I apologize for the confusion. Let me start over and be a little more clear so you understand what I am trying to do.

    I am using the Enfold Child Theme so I can use custom CSS to style certain text for my website using Google Fonts. I want to insert the following line of code from Google Fonts into the <HEAD> tag:

    <link href=’http://fonts.googleapis.com/css?family=Alex+Brush’ rel=’stylesheet’ type=’text/css’>

    After doing this, it allows me to create a class in the CSS stylesheet and use it as such. For example, I want to use the Alex Brush font to style specific text using the following CSS code:

    .fancy-1 {
        font-family:'Alex Brush', cursive;
        font-size: 2em;
    }

    What is the best method, using the Enfold Child Theme to accomplish this?

    • This reply was modified 10 years, 11 months ago by Geekcheck.
    in reply to: How to add Google Fonts to HEAD tag on website? #276866

    This adds the font to the General Styling list, but doesn’t allow me to call to it as a CSS class. For example, I have the following CSS class, I use for specific text in special cases:

    .fancy-1 {
        font-family:'Alex Brush', cursive;
        font-size: 2em;
    }
    

    Normally I would insert this into <HEAD> tag and then call to it from the stylesheet. But in order to do that I need to add it to the <HEAD> tag. Is there a way to dynamically add this to the <HEAD> tag without having to directly edit the file? I only ask, because in the event of an update, I would have to re-add that line of code again.

Viewing 3 posts - 1 through 3 (of 3 total)