Unique fonts with CSS and Custom Fields (4 posts)

  1. Consensio Systems
    Posted 2 years ago #

    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; ?>
    <?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!

  2. Michael
    Part-Time Forum Moderator
    Posted 2 years ago #

    review http://codex.wordpress.org/Conditional_Tags

    to target a specific page, try to use is_page()

  3. Consensio Systems
    Posted 2 years ago #

    I updated the tag from is_single to is_page, but still nothing changes. I also tried calling out the specific page number I'm trying to change, but again, nothing happened. Am I formatting the Custom Field Value correctly?

  4. Michael
    Part-Time Forum Moderator
    Posted 2 years ago #

    does the code output anything into the header (on a static page)?

    and if, what is the output?

    what if you just use the code without the conditional statements?

Topic Closed

This topic has been closed to new replies.

About this Topic