Attach files

<?php

//Add this snippet to functions.php - the 'input_3' is the name of the file upload field in gravity forms, the category 11 is the category your form posts to
function add_mp3_customfield($post){
if(isset($_FILES['input_3']) && in_category(11,$post)){
add_post_meta($post,'interview_mp3',$_FILES['input_3']['name']);
}
}
add_action('publish_post','add_mp3_customfield');
//End snippet number 1

//This is an example loop, for your template file, the real version creates links to play the mp3's but this example just prints out the filepath. Replace the number 8 with the id of your particular gravity form.

if( have_posts() ) : while ( have_posts() ) : the_post();

$mp3_filename = get_post_meta($post->ID, 'interview_mp3', true);
$mp3_path = 'http://' . $_SERVER['SERVER_NAME'] . '/wp-content/uploads/gravity_forms/8/' . date('Y') . '/' . date('m') . '/' . $mp3_filename;

echo $mp3_path;
echo '<br>';

endwhile;
endif;

?>

Custom field filter

<?php

//Use a filter to add data to the gravity form field that you assigned a populate dynamically name of "interview"
add_filter("gform_field_value_interview", "populate_interview");
function populate_interview($value){
$mp3_url = $_FILES['input_3']['name'];
return $mp3_url;
}

//Use an action hook to detect the post and add a custom field to the post
function populate_it($post){
if(isset($_FILES['input_3'])){
echo $_FILES['input_3']['name'];
echo $post;
add_post_meta($post,'interview',$_FILES['input_3']['name']);
}
}

add_action('publish_post','populate_it');

?>

Current page nav highlight

//Current Page Highlighting
function extractPageName(hrefString)
{
var arr = hrefString.split('/');
return (arr.length<2) ? hrefString : arr[arr.length-2].toLowerCase() + arr[arr.length-1].toLowerCase();
}

function setActiveMenu(arr, crtPage)
{
for (var i=0; i<arr.length; i++)
{
if(extractPageName(arr[i].href) == crtPage)
{
if (arr[i].parentNode.tagName != "DIV")
{
arr[i].className = "current";
arr[i].parentNode.className = "current";
}
}
}
}

function setCurrentPage(navId)
{
hrefString = document.location.href ? document.location.href : document.location;

if (document.getElementById(navId)!=null)
setActiveMenu(document.getElementById(navId).getElementsByTagName("a"), extractPageName(hrefString));
}

//End Current Page Highlighting

Allow Extensions

$allowedExtensions = array("pdf","doc","docx","txt","rtf");
$tmp_nme = $_FILES['resume']['tmp_name'];
$nme = $_FILES['resume']['name'];
if(in_array(end(explode(".",strtolower($nme))),$allowedExtensions)){
$ipath= $path."/".$nme;
copy($tmp_nme, $ipath);
chmod($ipath, 0777);
}

Style Combo Box

//Bonus:  Row height for dropdown

timeDropdown.dropdown.rowHeight=40;

var myFormatWhite:TextFormat = new TextFormat();
myFormatWhite.font = "DFC GillSansLight";
myFormatWhite.size = 15;
myFormatWhite.color = 0xffffff;

var myFormatBeige:TextFormat = new TextFormat();
myFormatBeige.font = "DFC GillSansLight";
myFormatBeige.size = 14;
myFormatBeige.color = 0xa18c52;

comboBox.textField.setStyle("embedFonts", true);
comboBox.textField.setStyle("textFormat", myFormatWhite);&lt;

comboBox.dropdown.setRendererStyle("embedFonts", true);
comboBox.dropdown.setRendererStyle("textFormat", myFormatBeige);

comboBox.prompt = "Province"; //default value that won't show in the dropdown
comboBox.addItem( { label:"New Brunswick", data:"New Brunswick" } );
comboBox.addItem( { label:"Nova Scotia", data:"Nova Scotia" } );
comboBox.addItem( { label:"Ontario", data:"Ontario" } );
comboBox.addItem( { label:"Prince Edward Island", data:"Prince Edward Island" } );