WordPress.org

Ready to get started?Download WordPress

Forums

OptionTree
Retrieving Typography Values (3 posts)

  1. lspoor
    Member
    Posted 2 years ago #

    Hey guys, with the Typograph option I can retrieve the values using

    $type = get_option_tree( 'type' );

    But how do I get the values specifically?

    So if I want to add the font family to my CSS what do I use to get it?

    I tried

    <?php echo $type['font-family']; ?>

    But that doesn't work, it just outputs a comma for some reason, any ideas what I'm doing wrong. I'm a newbie to this so it would of been cool for examples on how to use them all but I guess I'll have to learn :)

    http://wordpress.org/extend/plugins/option-tree/

  2. tdschrock
    Member
    Posted 2 years ago #

    Hey, I just have been trying to get this figured out as well....If you don't want to manually use the 'get_option_tree()' function and parse out the proper info into the correct css properties, you can do this...

    You'll need the following OptionTree fields set up:
    just one field of type CSS
    however many font options you want set up (for my theme, I'm using three)

    In the CSS box setting type this:

    #id-name-here {
    {{key-of-typography-field-here}}
    }

    Then, in your theme file include the line (typically in your header.php file):

    <link rel="stylesheet" href="<?php bloginfo('template_directory');?>/dynamic.css" type="text/css" />

    Then, in your html markup just use the id or class name
    example:

    <div id="id-name-here">formatted text here</div>

    Just for kicks, check out what OptionTree did to the file dynamic.css.

  3. tdschrock
    Member
    Posted 2 years ago #

    PS:

    You will have to go into the plugin files and change one line in the file functions.php.

    Line 272 should read

    $font[] = "color: " . $value['font-color'] . ";";

    I don't know why, but it currently (version 1.1.8.1) reads:

    $font[] = "font-color: " . $value['font-color'] . ";";

    This places a property called "font-color" in the file "dynamic.css" and there is no such property. CSS uses the property "color"

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic