ThemeForest

Posts by valendesigns

114 posts
  • Attended a Community Meetup
  • Author had a File in an Envato Bundle
  • Bought between 50 and 99 items
  • Elite Author
  • Envato Staff
  • Exclusive Author
  • Has been a member for 4-5 years
+3 more
valendesigns staff says




Just wanted to mention that OptionTree is the 36th most popular plugin in the WP Directory at the moment. Thanks everyone! Also, 2.0.8 should fix all the backwards compatibility issues and I’ve added a way to download your settings into a theme-options.php and it’s not just a var_export() either.

Hi derek,

with v2.0.8 if you export the settings.php with define(‘WP_DEBUG’, true); the php file exported is full of notices…

WP_DEBUG must always set to true when developing...
Parker
Debug mode is on for my local setup and I have zero notices. Also, it’s alway set to true I’m not an idiot.

I get this: http://pastie.org/4305774

Parker

That’s most likely because you created your own settings array. Had you used the UI builder to setup the settings array non of those would be showing because the UI builder sets all the array values even if they are empty. I’ll add an isset to everything for people who didn’t use the UI builder in the first place.

114 posts
  • Attended a Community Meetup
  • Author had a File in an Envato Bundle
  • Bought between 50 and 99 items
  • Elite Author
  • Envato Staff
  • Exclusive Author
  • Has been a member for 4-5 years
+3 more
valendesigns staff says



Hey, guys, could u say please why this doesn’t work?
function filter_ot_recognized_font_families( $array, $field_id ) {

  /* only run the filter when the field ID is my_google_fonts_headings */
  if ( $field_id == 'primary_typography-family' ) {
    $array = array(
      'sans-serif'    => 'sans-serif',
      'open-sans'     => '"Open Sans", sans-serif',
      'droid-sans'    => '"Droid Sans", sans-serif'
    );
  }

  return $array;

}
add_filter( 'ot_recognized_font_families', 'filter_ot_recognized_font_families', 10, 2 );
I still don’t have new fonts at select field :(
Then your field ID is incorrect.
Where could I find this field id? This isn’t an id of font-family select?

The field ID is whatever you set the typography option to on the settings page. Go to your setting page, find your specific option and click the edit button and the ID is the second input field.

114 posts
  • Attended a Community Meetup
  • Author had a File in an Envato Bundle
  • Bought between 50 and 99 items
  • Elite Author
  • Envato Staff
  • Exclusive Author
  • Has been a member for 4-5 years
+3 more
valendesigns staff says


Just wanted to mention that OptionTree is the 36th most popular plugin in the WP Directory at the moment. Thanks everyone! Also, 2.0.8 should fix all the backwards compatibility issues and I’ve added a way to download your settings into a theme-options.php and it’s not just a var_export() either.

Hi derek,

with v2.0.8 if you export the settings.php with define(‘WP_DEBUG’, true); the php file exported is full of notices…

WP_DEBUG must always set to true when developing...
Parker

Debug mode is on for my local setup and I have zero notices. Also, it’s alway set to true I’m not an idiot.

114 posts
  • Attended a Community Meetup
  • Author had a File in an Envato Bundle
  • Bought between 50 and 99 items
  • Elite Author
  • Envato Staff
  • Exclusive Author
  • Has been a member for 4-5 years
+3 more
valendesigns staff says

Hey, guys, could u say please why this doesn’t work?
function filter_ot_recognized_font_families( $array, $field_id ) {

  /* only run the filter when the field ID is my_google_fonts_headings */
  if ( $field_id == 'primary_typography-family' ) {
    $array = array(
      'sans-serif'    => 'sans-serif',
      'open-sans'     => '"Open Sans", sans-serif',
      'droid-sans'    => '"Droid Sans", sans-serif'
    );
  }

  return $array;

}
add_filter( 'ot_recognized_font_families', 'filter_ot_recognized_font_families', 10, 2 );
I still don’t have new fonts at select field :(

Then your field ID is incorrect.

114 posts
  • Attended a Community Meetup
  • Author had a File in an Envato Bundle
  • Bought between 50 and 99 items
  • Elite Author
  • Envato Staff
  • Exclusive Author
  • Has been a member for 4-5 years
+3 more
valendesigns staff says

Derek, thanks for your replies, could u explain what does this mean? if ( $field_id == ‘my_google_fonts_headings’ ) in Typography option for Custom Font-families. By the way, Derek, u see, here u can choose where to create your meta box, at post editor or page
/* Adds a box to the main column on the Post and Page edit screens */
function myplugin_add_custom_box() {
    add_meta_box( 
        'myplugin_sectionid',
        __( 'My Post Section Title', 'myplugin_textdomain' ),
        'myplugin_inner_custom_box',
        'post' 
    );
    add_meta_box(
        'myplugin_sectionid',
        __( 'My Post Section Title', 'myplugin_textdomain' ), 
        'myplugin_inner_custom_box',
        'page'
    );
}

http://codex.wordpress.org/Function_Reference/add_meta_box Maybe this info will be helpful.

The docs are updated in 2.0.8 please read them. Also, ‘my_google_fonts_headings’ is just a made up setting, you need to replace that with your own setting ID.

114 posts
  • Attended a Community Meetup
  • Author had a File in an Envato Bundle
  • Bought between 50 and 99 items
  • Elite Author
  • Envato Staff
  • Exclusive Author
  • Has been a member for 4-5 years
+3 more
valendesigns staff says

Thanks guys, but unfortunately your method doesn’t work either. When in the backend of WP you can’t check for a page template. I know because i’ve used metaboxes in this way in the past, and maybe i don’t know enough, but everything i tried didn’t work. is_page_template returns nothing in the admin. So in the past i’ve used _wp_page_template meta … Anyway, i asked if that array(pages) was modified in order to work with templates..
Yes, _wp_page_template will work, but again only after the post has been saved.

Unfortunately, it can’t be modified to work with templates as it limited to what the add_meta_box function excepts as parameters. That is unless you can think of a workaround.

114 posts
  • Attended a Community Meetup
  • Author had a File in an Envato Bundle
  • Bought between 50 and 99 items
  • Elite Author
  • Envato Staff
  • Exclusive Author
  • Has been a member for 4-5 years
+3 more
valendesigns staff says

Just wanted to mention that OptionTree is the 36th most popular plugin in the WP Directory at the moment. Thanks everyone! Also, 2.0.8 should fix all the backwards compatibility issues and I’ve added a way to download your settings into a theme-options.php and it’s not just a var_export() either.

114 posts
  • Attended a Community Meetup
  • Author had a File in an Envato Bundle
  • Bought between 50 and 99 items
  • Elite Author
  • Envato Staff
  • Exclusive Author
  • Has been a member for 4-5 years
+3 more
valendesigns staff says

Parker is correct, you’d have to test for the template and it would only work after it’s been saved once.

114 posts
  • Attended a Community Meetup
  • Author had a File in an Envato Bundle
  • Bought between 50 and 99 items
  • Elite Author
  • Envato Staff
  • Exclusive Author
  • Has been a member for 4-5 years
+3 more
valendesigns staff says



Hi Derek Version 2.0 rocks!! Is there any way to include a custom meta box only in a page template?
Can you elaborate because there are a couple ways I can interoperate that question?
I want to put a custom meta box inside a custom page template.. Like this:
$my_meta_box = array(
    'id'        => 'rb_',
    'title'     => 'My Meta Box',
    'desc'      => '',
    'pages'     => array( 'template-home.php' ),
    'context'   => 'normal',
    [ .... ]
It should be visible only inside that template, not in any other page..

Sorry, that will not work. The ‘pages’ array refers to the post_type in the add_meta_boxes() function. You can read more about it here http://codex.wordpress.org/Function_Reference/add_meta_box but basically it excepts any valid post type.

114 posts
  • Attended a Community Meetup
  • Author had a File in an Envato Bundle
  • Bought between 50 and 99 items
  • Elite Author
  • Envato Staff
  • Exclusive Author
  • Has been a member for 4-5 years
+3 more
valendesigns staff says

Hi Derek Version 2.0 rocks!! Is there any way to include a custom meta box only in a page template?

Can you elaborate because there are a couple ways I can interoperate that question?

by
by
by
by
by