9 posts
  • Bought between 50 and 99 items
  • Europe
  • Exclusive Author
  • Has been a member for 2-3 years
  • Sold between 50 000 and 100 000 dollars
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
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Exclusive Author
  • Interviewed on the Envato Notes blog
  • Beta Tester
  • Author had a File in an Envato Bundle
  • Author had a Free File of the Month
+4 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
  • Bought between 50 and 99 items
  • Exclusive Author
  • Has been a member for 4-5 years
  • 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

439 posts
  • Bought between 50 and 99 items
  • Europe
  • Exclusive Author
  • Has been a member for 2-3 years
  • Sold between 5 000 and 10 000 dollars
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
  • Exclusive Author
  • Sold between 5 000 and 10 000 dollars
  • Has been a member for 4-5 years
  • Europe
  • Envato Studio (Microlancer) Beta Tester
  • Bought between 1 and 9 items
  • Referred between 1 and 9 users
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
  • Power Elite Author: Sold between 1 000 000 - 1 999 999 dollars
  • Power Elite Author
  • Most Wanted Bounty Winner
  • Bought between 500 and 999 items
  • Referred between 500 and 999 users
  • Interviewed on the Envato Notes blog
  • Envato Studio (Microlancer) Beta Tester
  • Won a Competition
+8 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.

555 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Won a Competition
  • Interviewed on the Envato Notes blog
  • Contributed a Blog Post
+12 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
  • Power Elite Author: Sold between 1 000 000 - 1 999 999 dollars
  • Power Elite Author
  • Most Wanted Bounty Winner
  • Bought between 500 and 999 items
  • Referred between 500 and 999 users
  • Interviewed on the Envato Notes blog
  • Envato Studio (Microlancer) Beta Tester
  • Won a Competition
+8 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.

439 posts
  • Bought between 50 and 99 items
  • Europe
  • Exclusive Author
  • Has been a member for 2-3 years
  • Sold between 5 000 and 10 000 dollars
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
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Exclusive Author
  • Interviewed on the Envato Notes blog
  • Beta Tester
  • Author had a File in an Envato Bundle
  • Author had a Free File of the Month
+4 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