• Resolved hi5place

    (@hi5place)


    I am using OptionTree 2.3.4 WordPress Plugin. I want to know that how I can add a default/standard ( std ) value to Typography and Background option type? These both option types accepts std values in an array. Is there any way to add default values to these option types? or is there any filter for this task?

    Please suggest me some solution. Thanks in advance.

    https://wordpress.org/plugins/option-tree/

Viewing 3 replies - 1 through 3 (of 3 total)
  • joaofrassetto

    (@joaofrassetto)

    This is what documentation say about the field Standard: “Setting the standard value for your option only works for some option types. Those types are one that have a single string value saved to them and not an array of values.”. Then, I think setting a standard for this type of option won’t work.
    But, you when you retrieve the information with the function ot_get_option( $option_id, $default ), the second parameter, $default, can be an array. So, I think you can do this ot_get_option('my_typographic', array('helvetica', '8px', ...)). I can’t tell the order, but you can echo the return of a complete option an se the sequel.

    Something like this:

    array(
              'label'       => __( 'Heading', 'theme' ),
              'id'          => 'typography_heading',
              'section'     => 'typography',
              'type'        => 'typography',
              'desc'        => __( 'Select Type Here', 'theme' ),
              'std' => array(
                'font-family' => 'josefin_slab',
                'font-size' => '50px',
                'font-weight' => '300',
                'font-style' => '',
                'letter-spacing' => '',
                'line-height' => '56px',
                'text-transform' => ''
              )
            ),

    Get option

    $typography_heading = ot_get_option( 'typography_heading', array(
    		'font-family' => 'josefin_slab',
    		'font-size' => '50px',
    		'font-weight' => '300',
    		'font-style' => '',
    		'letter-spacing' => '',
    		'line-height' => '56px',
    		'text-transform' => ''
    	) );

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to add default standard value to typography element in OptionTree’ is closed to new replies.