This file contains hidden or 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
// https://docs.gravityforms.com/dynamically-populating-drop-down-fields/ | |
/* Instructions | |
- Create a form | |
- Add a "Dropdown" field | |
- Add "populate-posts" as the CSS class | |
*/ | |
add_filter( 'gform_pre_render_51', 'populate_posts' ); | |
add_filter( 'gform_pre_validation_51', 'populate_posts' ); |
This file contains hidden or 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
/*** add widget area *** */ | |
register_sidebar( array( | |
'name' => __( 'New Widget Area'), | |
'id' => 'new-widget-area', | |
'before_widget' => '<div id="%1$s" class="widget %2$s">', | |
'after_widget' => '</div>', | |
'before_title' => '<h3 class="widgettitle">', | |
'after_title' => '</h3>' | |
)); |
This file contains hidden or 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 | |
/* *** replace "your_parameter" with the parameter in the advanced tab | |
https://docs.gravityforms.com/using-dynamic-population/ */ | |
add_filter( 'gform_field_value_your_parameter', 'my_custom_population_function' ); | |
function my_custom_population_function( $value ) { | |
return 'boom!'; | |
} | |
/*Use this for a real estate form */ |
This file contains hidden or 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 create_zip_file(){ | |
$zip = new ZipArchive(); | |
$filename = "test114.zip"; | |
if ($zip->open($filename, ZipArchive::CREATE)!==TRUE) { | |
exit("cannot open <$filename>\n"); | |
} | |
$zip->addFile($_SERVER['DOCUMENT_ROOT']."/wp-content/uploads/2018/01/Bus-Card-ABC-Domestic-Live-Kelly-Ryan.jpg"); | |
$zip->close(); | |
} |
This file contains hidden or 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 below code to the page where all the information that should be displayed in the Loop */ | |
/* *** this is the link to click */ ?> | |
<a class="more-info-link <?php tribe_events_event_classes() ?>" style="cursor:pointer">More Info</a> | |
<? /* *** this is the box that holds more info */ ?> | |
<div class="more-info <?php tribe_events_event_classes() ?>" style="display:none;"> | |
<? /* *** This is where all the info goes that should be in the hidden box */ ?> | |
</div> |
This file contains hidden or 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
<? | |
// Change 'XXX' to your form id | |
$location_form_id = XXX; | |
add_filter( 'gform_pre_render_'.$location_form_id, 'limit_choices' ); | |
add_filter( 'gform_pre_validation_'.$location_form_id, 'limit_choices' ); | |
add_filter( 'gform_pre_submission_'.$location_form_id, 'limit_choices' ); | |
add_filter( 'gform_pre_submission_filter_'.$location_form_id, 'limit_choices' ); | |
add_filter( 'gform_admin_pre_render_'.$location_form_id, 'limit_choices' ); | |
function limit_choices( $form ) { |
This file contains hidden or 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 /** | |
* The WordPress Query class. | |
* @link http://codex.wordpress.org/Function_Reference/WP_Query | |
* | |
*/ | |
$args = array( | |
//Post & Page Parameters | |
'p' => 1, | |
'name' => 'hello-world', |
This file contains hidden or 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 | |
form_id = 1; | |
add_action("gform_post_submission_".$form_id, "add_new_post_featured_image"); | |
function add_new_post_featured_image($entry){ | |
$title_id = 1; | |
$content_id = 2; | |
$file_id = 3; | |
$new_post = array( | |
'post_title' => $entry[$title_id], |
This file contains hidden or 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
<? | |
// see this gist for creating dynamic checkboxes - https://gist.github.com/leepettijohn/28499de95fae967845728ec0be7a43d0 | |
$checktag = 1; //This should stay as 1 | |
$beertag = 16; //This should be the field_id of the checkbox field | |
while (isset($entry["{$beertag}.{$checktag}"])){ | |
if (!empty($entry["{$beertag}.{$checktag}"])){ | |
wp_set_post_terms($new_beer_id,$entry["{$beertag}.{$checktag}"],'post_tag',true); | |
} | |
$checktag++; | |
if ($checktag % 10 == 0){ |