• Resolved dpuk44

    (@dpuk44)


    I am using the Option Tree plugin with wordpress to create a theme. I want to use a dynamic css file and I understand this feature is built into option tree. I installed the plugin from the add new plugin WordPress option – i’m not sure if that makes a difference?

    I have created a dynamic.css file and put it in my themes root directory, and I have linked to it using wp_enqueue_style.

    In option tree I have a section called general (with an ID of general) and a setting called Background Image (with an ID of background_image) and have uploaded an image.

    In my dynamic css file I have the following code:

    body {
    {{background_image}}
    background-image: {{general|background_image}};;
    }

    but this doesn’t output the image I uploaded in my theme options. Can anyone guide me through the process to make this work please?

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

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

    (@valendesigns)

    If the setting is an upload option type then you would do:

    body {
      background-image: {{background_image}};
    }

    If the option type is the background option type you would do:

    body {
      background-image: {{background_image|background-image}};
    }

    Or use the entire value of the background option type which will automatically insert the correct CSS for the background color, image and other settings.

    body {
      {{background_image}}
    }

    When you are trying to get a key from the array of values for a specific option you don’t use the section ID at all. You use the setting ID followed by a pipe “|” and the key of the item in the array you want. In the case of the background option type the image is saved to the background-image array key. Using general will do nothing, other than what you’re experiencing, which is an empty value because there is no general setting.

    how can i pull a background image from option tree for one specific row lets say testimonials.
    Can anyone help me out with the code.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Option Tree CSS issue’ is closed to new replies.