9 posts
  • Has sold $40,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Has been part of the Envato Community for over 2 years
  • Sells items exclusively on Envato Market
+1 more
raybreaker says


How to create checkbox that checked by default? I trying following but it won’t work:
array (
'label' => 'Something',
'id' => 'something',
'type' => 'checkbox',
'choices' => array (
  'label' => 'On',
  'value' => 'On'
),
'std' => 'On',
'section' => 'home_page'
)

your code should be:

array (
  'label' => 'Something',
  'id' => 'something',
  'type' => 'checkbox',
  'choices' => array (
    array(
      'label' => 'On',
      'value' => 'On'
    )
  ),
  'std' => 'On',
  'section' => 'home_page'
)
Try that and see if you get better results.

Still does not work.

3256 posts
  • Has referred 100+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+9 more
ParkerAndKent says


@epicera

That would be awesome…

Anyway, right now, you can copy the base64 string of the settings and make an update_option on theme activation:

update_option('option_tree_settings', base64_decode($your_settings_string));

For the new metaboxes you have to make the options array manually, but for the theme options it’s just easy like the example above.

Parker
It would be preferable to actually create an array for new themes and update your old ones when you have time.

I know, in fact I’ve made a huge file manually these days :) That’s just for authors that have many themes that need to be updated.

Parker

13 posts
  • Has been part of the Envato Community for over 4 years
  • Has collected 50+ items on Envato Market
  • Sells items exclusively on Envato Market
  • Located in Sweden
DesignByWilliam says

Derek,

Ill be using your option tree probably in my first theme to be released. Im not sure yet but im looking into it since it would save me some time:)

But i wouldn’t feel right using it not donating. So theme is out, how can i donate to you?

Maybe you o charge for this, but then i just haven’t found where or how much yet so please point me in the right direction in that case.

/william

438 posts
  • Has been part of the Envato Community for over 2 years
  • Has sold $5,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Located in Europe
+1 more
Pixelous says

Derek,

Ill be using your option tree probably in my first theme to be released. Im not sure yet but im looking into it since it would save me some time:)

But i wouldn’t feel right using it not donating. So theme is out, how can i donate to you?

Maybe you o charge for this, but then i just haven’t found where or how much yet so please point me in the right direction in that case.

/william

Here what u’re looking for http://bit.ly/NuXI3T

332 posts
  • Has referred 1+ members
  • Has sold $5,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 1+ items on Envato Market
+3 more
dekciw says

So, I’m working on a new theme. Gonna integrate this precious plugin into it.. but. I’ve developed custom post type named ‘Sliders’. It supports just title. Integrated OptionTree into the theme, and created metaboxes as I was supposed to (using list item field for slider images). But after I upload the image to the list item, I cannot find ‘send to post’ button :( Tho, I found a fix, which fixed it.

add_filter('get_media_item_args', 'force_send_to_post');
function force_send_to_post($vars) {
    $vars['send'] = true; // 'send' as in "Send to Editor" 
    return($vars);
}
922 posts
  • Has referred 500+ members
  • Has sold $1M+ on Envato Market and is now a Power Elite Author
  • Has been a beta tester for an Envato feature
  • Has collected 500+ items on Envato Market
+13 more
MDNW says

For anyone trying to migrate their OT 1 .X themes to OT 2 .X, I just put together a writeup for the process that I’m using. It takes me about 10-15 minutes per theme… which is a fair bit better than the 2-3 hours per theme I was looking at if I had to manually create each theme-options.php array. I honestly don’t know if Derek or anyone else might have better ideas for this stuff, but I figure it doesn’t hurt to share:

http://snippi.com/s/9pa94k0

Oh, and Derek, P&K, and anyone else who wants to chime in – feel free to yell at me and throw rocks if I’m doing it wrong. Ideally we’ll have a simple “theme-option.php” export method from the Theme Builder UI in the future… so this is just a workaround until that happens.

563 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $750,000+ on Envato Market
  • Had an item featured in a magazine
  • Made it to the Authors' Hall of Fame
+17 more
theMOLITOR says

For anyone trying to migrate their OT 1 .X themes to OT 2 .X, I just put together a writeup for the process that I’m using. It takes me about 10-15 minutes per theme… which is a fair bit better than the 2-3 hours per theme I was looking at if I had to manually create each theme-options.php array. I honestly don’t know if Derek or anyone else might have better ideas for this stuff, but I figure it doesn’t hurt to share: http://snippi.com/s/9pa94k0 Oh, and Derek, P&K, and anyone else who wants to chime in – feel free to yell at me and throw rocks if I’m doing it wrong. Ideally we’ll have a simple “theme-option.php” export method from the Theme Builder UI in the future… so this is just a workaround until that happens.

You rock.

922 posts
  • Has referred 500+ members
  • Has sold $1M+ on Envato Market and is now a Power Elite Author
  • Has been a beta tester for an Envato feature
  • Has collected 500+ items on Envato Market
+13 more
MDNW says

@themolitor: Anytime! – I wish I’d been around last week to help grease the way and get something like this written ahead of time as I know there’s a handful of us that use OT exclusively for our themes and we all pretty much need to update.

Edit to the snippet above – I just noticed that I didn’t mention that you need to also turn the Theme Mode setting to “__return_false” when you want to make theme-option edits (OT2.0 wisely prevents theme users from changing the values without turning the theme mode off… which pretty much means that only people who know what they are doing can turn it off and make changes). I’ll see if I can’t make a cleaner, prettier version of that walkthrough this weekend incorporating any other notes that I may have.

Also – note that Derek recommends using a “unserialize” function (see page 7 on this thread) when you whip out the .txt file… I didn’t end up needing to do that, but if you don’t get this working, try adding it in there.

438 posts
  • Has been part of the Envato Community for over 2 years
  • Has sold $5,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Located in Europe
+1 more
Pixelous says

valendesigns or anyone else, could u provide an example how could I get width and height of uploaded image? Here is my code:

<?php
if ( function_exists( 'ot_get_option' ) ) {
    $logo = ot_get_option( 'logo' );
}
?>

<img src="<?php echo $logo; ?>" width="?" height="?" />
3256 posts
  • Has referred 100+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+9 more
ParkerAndKent says

Also – note that Derek recommends using a “unserialize” function (see page 7 on this thread) when you whip out the .txt file… I didn’t end up needing to do that, but if you don’t get this working, try adding it in there.

There’s no need to unserialize when using update_option, because then wp in any case seializes any array by itself.

If you don’t unserialize it, it will be saved serialized, if you unserialize it and then update the option, wp will serialize it back for you…

So, in any case it will be saved serialized… :)

Parker

by
by
by
by
by
by