3 posts
    Has been part of the Envato Community for over 1 year Sells items exclusively on Envato Market
ismayanti says

Hi all, Im new in PHP, please help me to solve the problem. I want to create multiple background in my theme but have trouble, this is the code :

array( 'id' => 'background-img', 'label' => 'Choose Background', 'std' => 'pattern-0', 'type' => 'radio-image', 'section' => 'styling', 'class' => ' ', 'choices' => array( array( 'value' => 'pattern-0', 'label' => 'Default', 'src' => get_template_directory_uri() . '/functions/images/pattern-0.png' ), array( 'value' => 'pattern-1', 'label' => 'Pattern-1', 'src' => get_template_directory_uri() . '/functions/images/pattern/pattern-1.png' ), array( 'value' => 'pattern-2', 'label' => 'Pattern-2', 'src' => get_template_directory_uri() . '/functions/images/pattern/pattern-2.png' ), array( 'value' => 'pattern-3', 'label' => 'Pattern-3', 'src' => get_template_directory_uri() . '/functions/images/pattern/pattern-3.png' ) ) ),

And Call with this :

if ( of_get_option('background-img') != '' ){ if ( of_get_option('background-img') != '' ) { $styles .= '.background-img { background: url('.get_template_directory_uri().'/functions/images/pattern/pattern-0.png) repeat; }'."\n"; }else if( of_get_option('background-img') != '' ){ $styles .= '.background-img { background: url('.get_template_directory_uri().'/functions/images/pattern/pattern-1.png) repeat; }'."\n"; }else if( of_get_option('background-img') != '' ){ $styles .= '.background-img { background: url('.get_template_directory_uri().'/functions/images/pattern/pattern-2.png) repeat; }'."\n"; }else{ $styles .= '.background-img { background: url('.get_template_directory_uri().'/functions/images/pattern/pattern-3.png) repeat; }'."\n"; } }
3 posts
    Has been part of the Envato Community for over 1 year Sells items exclusively on Envato Market
ismayanti says

The background doesn’t change when I select from Optiontree panel. What the right code to call it?

3521 posts Ruben Bristian
    Sells items exclusively on Envato Market Elite Author: Sold more than $75,000 on Envato Market Has sold $500,000+ on Envato Market Has been part of the Envato Community for over 6 years
+10 more
KrownThemes says

Where did you get this code from? It’s ot_get_option, not of_get_option ....

3 posts
    Has been part of the Envato Community for over 1 year Sells items exclusively on Envato Market
ismayanti says

The code from the internet. I change to ot_get_option but it same with before, the background doesn’t change

3521 posts Ruben Bristian
    Sells items exclusively on Envato Market Elite Author: Sold more than $75,000 on Envato Market Has sold $500,000+ on Envato Market Has been part of the Envato Community for over 6 years
+10 more
KrownThemes says

Well, you aren’t outputting the background anywhere. That code is useless. Output ot_get_option(‘background-img’) somewhere. You have the same if statement with the same result four times. You should first learn PHP or programming basics before playing with frameworks and stuff.

by
by
by
by
by
by