Skip to content

Instantly share code, notes, and snippets.

View tripflex's full-sized avatar
🦋
in the zone

Myles McNamara tripflex

🦋
in the zone
View GitHub Profile
@tripflex
tripflex / confToHashTable.ps1
Last active August 29, 2015 14:09
Powershell RegEx to Hash Table Key->Value pairs
$configData = "system_date='2014/11/13'
system_time='14:40:15'
system_ntp='192.168.150.48'
system_daylight_enable='1'
system_updateinterval='3600'
"
$regex = [regex]("(\w+)(?=='(.*)')")
@tripflex
tripflex / date.min.js
Created December 2, 2014 20:03
date picker select from any dates
jQuery(function(a){a(".jmfe-date-picker").each(function(){a(this).datepicker({dateFormat:jmfe_date_field.date_format,monthNames:jmfe_date_field.monthNames,monthNamesShort:jmfe_date_field.monthNamesShort,dayNames:jmfe_date_field.dayNames,dayNamesShort:jmfe_date_field.dayNamesShort,dayNamesMin:jmfe_date_field.dayNamesMin})})});
@tripflex
tripflex / gist:878b4af974731e700b55
Created January 13, 2015 00:38
add this code to your theme's functions.php file
// Add your own function to filter the fields
add_filter( 'submit_resume_form_fields', 'custom_submit_resume_form_fields' );
// This is your function which takes the fields, modifies them, and returns them
// You can see the fields which can be changed here: https://github.com/mikejolley/WP-Job-Manager/blob/master/includes/forms/class-wp-job-manager-form-submit-job.php
function custom_submit_resume_form_fields( $fields ) {
// Here we target one of the job fields (job_title) and change it's label
$fields['resume_fields']['candidate_experience']['employer']['label'] = "Organization/Employer";
@tripflex
tripflex / gist:12fffc123b9503355b7b
Last active August 29, 2015 14:13
custom taxonomy php output options
// Get the custom field taxonomy selected term ID's
$field_value = get_custom_field("outsourcing_partial_type");
if ( is_array( $field_value ) ) {
foreach ( $field_value as $selected_value ) {
$tax = get_term_by( 'id', (int) $selected_value, "outsourcing_partial_type" );
// Set the name of the taxonomy an an item in a new array
$tax_labels[] = $tax->name;
// Or you could just output it in this for loop
// Change job_listing_meta_end to job_listing_meta_start to output at start
add_action( 'job_listing_meta_end', 'add_salary_to_job_listing' );
function add_salary_to_job_listing(){
// Assuming the meta key is job_salary
$field_value = get_job_field( 'job_salary' );
echo "<li>Salary: " . $field_value . "</li>";
}
<div class="single_job_listing" itemscope itemtype="http://schema.org/JobPosting">
<meta itemprop="title" content="<?php echo esc_attr( $post->post_title ); ?>" />
<?php if ( $post->post_status == 'expired' ) : ?>
<div class="job-manager-info"><?php _e( 'This listing has expired', 'wp-job-manager' ); ?></div>
<?php else : ?>
<?php
@tripflex
tripflex / gist:41405633a920cb1dc379
Created January 28, 2015 16:07
Convert date timestamp to any format with PHP
<?php
$date = "15-01-28";
$timestamp = strtotime( $date );
// See http://php.net/manual/en/function.date.php for available formats
echo date( "F j, Y", $timestamp );
?>
@tripflex
tripflex / gist:83777e99b03b77baa499
Created February 6, 2015 18:05
Job Category output on listing
<?php
$categories = get_the_terms( get_the_ID(), 'job_listing_category' );
foreach ( $categories as $category ){
echo $category->name;
}
?>
@tripflex
tripflex / foreach.php
Last active August 29, 2015 14:15
multi-select custom field as bulleted list ( foreach and implode examples )
// Start UL (Unordered List)
echo "<ul>";
// Get the field value
$amenities = get_custom_field( 'job_amentities' );
// Make sure there is a value
if( ! empty( $amentities ) ){
// An Array would be multiple selections
@tripflex
tripflex / gist:b2b55d5682b48b6e892d
Created February 25, 2015 20:04
Output multiple file upload images
<?php
$realisations = get_custom_field( 'candidate_realisation' );
if( ! empty( $realisations ) ){
foreach( $realisations as $realisation ){
echo '<img src="' . $realisation . '" class="_candidate_realisation" />';
}
}
?>