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
<div id="voting-form" style="display:none"> | |
<?php echo do_shortcode( '[gravityform id="6" title="false" description="false" ajax="true"]' ) ?> | |
</div> | |
<a href="#voting-form" class="fancybox button">Vote Now</a> |
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
function my_city_population_function( $value ){ | |
return 'Vancouver'; | |
} | |
add_filter( 'gform_field_value_my_city', 'my_city_population_function' ); |
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
function limit_file_upload_size( $validation_result ) { | |
$form = $validation_result['form']; | |
foreach( $form['fields'] as &$field ){ | |
// NOTE: Add a custom CSS class to your image upload field and grab onto it here... | |
if( strpos( $field['cssClass'], 'choose-file' ) === false ) | |
continue; | |
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
function populate_concept_nominees( $form ){ | |
foreach ( $form['fields'] as &$field ){ | |
// Set a custom CSS class for your field and grab onto it here | |
if ( $field['type'] != 'select' || strpos( $field['cssClass'], 'populate-concept' ) === false ) | |
continue; | |
// Query parameters for get_posts |
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
function my_custom_validation( $validation_result ) { | |
$form = $validation_result["form"]; | |
// Sorry, you don't get to live in Vancouver... | |
if ( $_POST['input_1'] == 'Vancouver' ) { | |
$validation_result["is_valid"] = false; | |
foreach ( $form["fields"] as &$field ) { |
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 | |
function no_duplicate_votes($validation_result){ | |
global $wpdb; | |
$nominee_field = 1; | |
$email_field = 2; | |
$form = $validation_result['form']; | |
foreach( $form["fields"] as &$field ) { | |
if ( $field['id'] == $email_field ) { | |
$email_value = rgpost("input_{$field['id']}"); |
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 | |
/** | |
* Usage: "echo get_option('plugin_error');" or look for the option the DB after activation | |
* | |
* @link http://thehungrycoder.com/wordpress/how-i-have-solved-the-the-plugin-generated-xxxx-characters-of-unexpected-output-during-activation-problem.html | |
*/ | |
function save_error(){ | |
update_option( 'plugin_error', ob_get_contents()) ; |
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
$ /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --allow-file-access-from-files |
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
// Reference: http://lea.verou.me/2011/10/easily-keep-gh-pages-in-sync-with-master/ | |
$ git add . | |
$ git status // to see what changes are going to be commited | |
$ git commit -m 'Some descriptive commit message' | |
$ git push origin master | |
$ git checkout gh-pages // go to the gh-pages branch | |
$ git rebase master // bring gh-pages up to date with master | |
$ git push origin gh-pages // commit the changes |
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 | |
/** | |
* Add the metabox. | |
*/ | |
function my_url_add_metabox() { | |
add_meta_box( | |
'my_url_section', // The HTML id attribute for the metabox section | |
'My URL Metabox Title', // The title of your metabox section |
OlderNewer