• Resolved igid26

    (@igid26)


    Hi,
    I use Option Tree Custom Option Types. I’m trying to insert in theme color picker with opacity and Spacing. For Spacing I used code.

    if ( function_exists( 'ot_get_option' ) ) {
      /* get the array, and have a default just incase */
      $color_opacity = ot_get_option( 'color_opacity', array( '10', 'px' ) );
    
      /* implode array into a string value */
      if ( ! empty( color_opacity ) ) {
        echo implode( '', $color_opacity );
      }
    
    }

    But it display padding along. example: padding: 510510px
    I need padding: 5px 5px 10px 10px. I also need the code for color opacity

    Sorry for my English.

    https://www.ads-software.com/plugins/option-tree/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Derek Herman

    (@valendesigns)

    What is the array output of color_opacity when there are multiple values?

    Plugin Author Derek Herman

    (@valendesigns)

    If it’s just an array like array( '5', '10', '5', '10' ) then the code would be:

    if ( function_exists( 'ot_get_option' ) ) {
      /* get the array, and have a default just incase */
      $color_opacity = ot_get_option( 'color_opacity', array( '10' ) );
    
      /* implode array into a string value */
      if ( ! empty( color_opacity ) ) {
        echo implode( 'px ', $color_opacity );
      }
    
    }
    Thread Starter igid26

    (@igid26)

    Thank you for answering

    The code works but if is in settings theme specified value px or % do not working. Because it shows the value: padding: 5px 5px 10px 10px px; or 5px 5px 10px 10px %;. Last px or% must be deleted. When the value of px in the settings theme code works correctly.

    Thread Starter igid26

    (@igid26)

    How do I add the code into css? For example for class flex-title.
    Thanks

    Plugin Author Derek Herman

    (@valendesigns)

    Is this still an issue for you or have you figured it out?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Custom Option Types’ is closed to new replies.