Support » Fixing WordPress » Unique fonts with CSS and Custom Fields

  • Greetings! I’m trying to setup some A/B tests in regards to different fonts used in headlines. I’ve setup a unique page and rather than editing the style.css file I’m trying to just change the font for this specific page. Here is what I’ve done:

    In the main header file I’ve added the following code (found this code surfing around looking for solutions):
    <?php if (is_single()) {
    $customcss = get_post_meta($post->ID, ‘css’, true);
    if (!empty($customcss)) { ?>
    <style type=”text/css”>
    <?php echo $customcss; ?>
    </style>
    <?php }
    } ?>

    Then on the unique page I setup. I created a Custom Field under css and used the following statement for the value:
    h1{font-family: Georgia, ‘Times New Roman’, Times;
    }
    body{font-family: Georgia, ‘Times New Roman’, Times;
    }

    However, nothing changes when I go to preview the page – the font is still in the original Sans-Serif fonts. Could one of the following issues be at fault?

    1. Incorrect formatting of the value section of the Custom Field?
    2. There is additional code in the header file that specifies loading of the fonts. Could this code be overriding the Custom Field I setup? Here is the code:
    <script type=”text/javascript” src=”http://use.typekit.com/kml1qzr.js”></script>
    <script type=”text/javascript”>try{Typekit.load();}catch(e){}</script>

    Thank you in advance for the help!

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Unique fonts with CSS and Custom Fields’ is closed to new replies.