Posts by valendesigns

119 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 50+ members
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Had an item featured in an Envato Bundle
+8 more
valendesigns Envato team says



valendesigns, sorry I am bothering u with all these questions, why not just make image width and height as a default feature in your plugin? Thanks.

It’s OK you’re asking questions I don’t mind. As far as my opinion on your feature request, you might be making assumptions that everyone needs to know the image height and width. OptionTree wasn’t created to do everything for you it’s meant to be extendable. You can always create your own custom option types if you need niche options and hook into the validation filter to keep them clean in the DB.

Quick question though, why do you need the height and width, why is that important to you?
At first these attributes speed up the rendering of the page and for the second I need my logo to be aligned center :)

You can center align it with CSS . I believe this will do the trick.

.your-image-class {
  display: block;
  margin: 0 auto;
}
119 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 50+ members
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Had an item featured in an Envato Bundle
+8 more
valendesigns Envato team says

valendesigns, one more question. In case of Step 1: Include the plugin & turn on theme mode, should I still wrap my code with function_exists? Thanks.

If you’re including it in your theme you do not need to use function_exists.

119 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 50+ members
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Had an item featured in an Envato Bundle
+8 more
valendesigns Envato team says

valendesigns, sorry I am bothering u with all these questions, why not just make image width and height as a default feature in your plugin? Thanks.

It’s OK you’re asking questions I don’t mind. As far as my opinion on your feature request, you might be making assumptions that everyone needs to know the image height and width. OptionTree wasn’t created to do everything for you it’s meant to be extendable. You can always create your own custom option types if you need niche options and hook into the validation filter to keep them clean in the DB.

Quick question though, why do you need the height and width, why is that important to you?

119 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 50+ members
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Had an item featured in an Envato Bundle
+8 more
valendesigns Envato team says

valendesigns, what about my question, any thoughts?

You need to get the attachment ID from the URL . Try this and see if it helps.

http://wordpress.stackexchange.com/questions/6645/turn-a-url-into-an-attachment-post-id
119 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 50+ members
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Had an item featured in an Envato Bundle
+8 more
valendesigns Envato team says

I just want to throw it out there that I was vocal about the upgrade and asked for testers here and on twitter in advance and with plenty of notice before going live. Unfortunately, not everyone tested their themes. I am sincerely apologetic for the compatibility issues, it sucks I know. It’s just unfortunate that the awesomeness is being highjacked by this snafu, and is taking away from how much of an improvement the plugin really is. That’s a bit upsetting, but I’ll get over it.

On to more important matters. I have not stopped working on trying to find a fix since this started. As you can see, I’ve pushed out 6 patches in an attempt to make it stable, and about to push out another one that will hopefully fix some themes, I can’t say all because I’m only aware of the issues you tell me about or I get from installing one of your themes and finding the point where it’s breaking. As of 20 minutes ago I believe I have found a fix for Cudazi themes and will push it live once I’ve got a few other people to test it. The updated code is on the development branch over at github.

https://github.com/valendesigns/option-tree/tree/development

Cheers, Derek

119 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 50+ members
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Had an item featured in an Envato Bundle
+8 more
valendesigns Envato team 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.

119 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 50+ members
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Had an item featured in an Envato Bundle
+8 more
valendesigns Envato team says

Update – I couldn’t get this to work when I added “unserialize”... I could just be doing it wrong, but I tried it a few ways and had no luck. I tested it pretty thoroughly though and my method seems to work nicely… at least it does in my setup.

Are there any reason not to use this as a temporary stopgap?

Should I be concerned that it’s working without the “unserialize” function?

The export is an array in the DB that is serialized and then base64 encoded so when you save it back to the DB you want it to be an array which means to first decode then unserialize. The code below is how the option_tree_settings is echoed out to the screen. So if you are getting it to work your way I’m a little confused.


/* get theme options data */
$settings = get_option( 'option_tree_settings' );
$settings = ! empty( $settings ) ?  base64_encode( serialize( $settings ) ) : '';

echo '<div class="format-setting-inner">';
  echo '<form action="options.php" method="post" id="option-tree-settings-api">';
    echo '<textarea rows="10" cols="40" name="export_settings" id="export_settings" class="textarea">' . $settings . '</textarea>';
  echo '</form>';
echo '</div>';
119 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 50+ members
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Had an item featured in an Envato Bundle
+8 more
valendesigns Envato team says


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

Got it – I’ll mess around with this for a bit – What I might do temporarily is add the serialized version (if I can get it working) just to give me a stopgap until I can write out all of the new arrays.

Either way, the new OT is the bomb yo! (in your best Jesse Pinkman voice) There’s obviously been a TON of work going on behind the scenes and I’m as stoked about all of the new features. The growing pains will pass ;)

also if you’re going to save it directly you need to do this:

update_option( 'option_tree_settings', unserialize( base64_decode( $your_settings_string ) ) );
119 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 50+ members
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Had an item featured in an Envato Bundle
+8 more
valendesigns Envato team 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.

119 posts
  • Has been part of the Envato Community for over 6 years
  • Has referred 50+ members
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Had an item featured in an Envato Bundle
+8 more
valendesigns Envato team says

Question for Derek or anyone else using the new version:

I might be missing something obvious… but is there a way for theme-developers to automatically export a “theme-options.php” file without needing to manually type out the options into an array?

My issue is that I’ve got a bunch of themes that use the old XML method. The new method is way better (agreed), but is there a way to convert my old “theme-options.xml” file to the new “theme-options.php” format?

I see that we can export a serialized version of the settings that we can tell users to import… but that’s ghetto, right? ;) I want to be able to export a theme-options.php file directly from OptionTree that I can drop into my theme’s “includes” folder that’ll automatically load up when the theme is activated.

Any ideas? Did I miss the big “Export Theme Options as a PHP File” button? Or do I need to actually re-type out all of my theme options into arrays?

I’ll look into adding an export to php array this weekend. Currently, I’m supporting a handfull of people and their issues because authors did not test their theme for compatibility and customers upgraded and their are some quirks here and their.

Hopefully, I’ll be able to iron out any problem in the next couple of days.

by
by
by
by
by
by