I’m relatively new to WordPress theme development, and I had to create a theme with options tree. I have successfully add some options with options tree plugin in my wordpress theme.But i am really stand when i go to add Background option. I have complete section an settings on theme option with ‘type’ => ‘background’, after i see i have find some options on dashboards theme options like ‘select color’, ‘background-repeat’, ”background-attachment’, ‘background-position’ and background size. Now i want to query all methods but i have did’nt know how can i do this. exactly i want to do dynamic this code
body{background:url(from option tree attach file) option tree repeat option scroll options tree position options tree background size options tree color}
this is exact css body{background:url(img/body_bg.png) no-repeat scroll 0 0 # ddd}. Any one Please help me.
You can try something like this….
I personally use this for my premium themes.
http://www.wpmania.net
so first you have to create a option for background…..
then you can show the option using following code….
body
{
background-color: ;
background-repeat:;
background-attachment:;
background-position:;
background-image:url() ;
}
Actually when you create a background option it generate an array and you need to have all the data separately. I also improved the above code into a PHP function. Please check it out as well…..
This function has several arguments…
$wpm_options : it will be your option tree field id
$wpm_class : Your css selector name for which you are adding css
$identifier : your css selector identifier whether it is a class or id. Just put # when it is id and put ” . ” when it is a class. And leave it blank when it is a HTML tag. Like for body you can leave it empty.
PM me if you need more clarification.
Thanks
Sabbir
People are asking me how to use background option for betabox ( OptionTree Metabox )…..
First of all, you have to write the following codes within the loop Otherwise it might not work……
If you still need more help just PM me. I must get back to you when I get some time.
@wpmania.net
I am currently using the wordpress inline style function to add the css for posts & pages after my main stylesheet is being loaded. Using the metaboxes from option tree ofc.
EDIT: I forgot to mention that this part of code is inside the main wp_enqueue_script function