Last active
August 29, 2015 14:22
-
-
Save bearded-avenger/a4be4ea9572590f2a8ad to your computer and use it in GitHub Desktop.
lasso sample meta plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Lasso Sample Settings Addon | |
* | |
*/ | |
add_filter('lasso_modal_tabs','try_tabs'); | |
function try_tabs( $tabs ){ | |
$tabs[] = array( | |
'name' => 'Tab', | |
'content' => 'mytestcallback', | |
'options' => 'myOptionsCallback' | |
); | |
return $tabs; | |
} | |
function mytestcallback(){ | |
ob_start(); | |
?> | |
<div class="lasso--postsettings__option"> | |
<p style="line-height:1.2;margin-bottom:0;">Whoah! We're working on this sweet meta option API that will allow you to create settings fields for your addon to integrate with Lasso!</p> | |
</div> | |
<?php | |
return ob_get_clean(); | |
} | |
function myOptionsCallback(){ | |
$options = array( | |
array( | |
'id' => 'title', | |
'name' => 'Title', | |
'type' => 'text', | |
'default' => 'default', | |
'desc' => 'Cool' | |
), | |
array( | |
'id' => 'another', | |
'name' => 'Another', | |
'type' => 'textarea', | |
'default' => 'default', | |
'desc' => 'Awesome' | |
), | |
array( | |
'id' => 'sally', | |
'name' => 'Sweet', | |
'type' => 'checkbox', | |
'default' => 'default', | |
'desc' => 'Whoah' | |
) | |
); | |
return $options; | |
} | |
add_filter('lasso_api_params_MYACTION', function( $params ){ | |
$params['lasso_api_params_MYACTION']['testone'] = array('trim','sanitize_text_field'); | |
$params['lasso_api_params_MYACTION']['twostep'] = array('trim','sanitize_text_field'); | |
}, 10, 1 ); | |
add_filter('lasso_meta_fields', function( $fields ){ | |
$fields = array( | |
'testone', | |
'twostep' | |
); | |
return $fields; | |
}, 10, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment