Skip to content

Instantly share code, notes, and snippets.

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

Myles tripflex

🦋
in the zone
View GitHub Profile
@tripflex
tripflex / functions.php
Last active August 29, 2015 14:18
Auto set phone field type flag by visitors IP, and set country(s) at top of list
<?php
add_filter( 'job_manager_field_editor_phone_args', 'my_custom_phone_args' );
function my_custom_phone_args( $args ){
// Other available arguments, see GitHub for details
// https://github.com/Bluefieldscom/intl-tel-input#options
//
// $args['allowExtensions'] = 'false';
// $args['autoFormat'] = 'true';
@tripflex
tripflex / wc.php
Created April 19, 2015 02:07
WCPL get_packages function update to support new WCPL filenames
/**
* Get packages in Field Editor format
*
*
* @since 1.2.2
*
* @param bool $as_array
*
* @return array|string
*/
@tripflex
tripflex / formatted.php
Last active August 29, 2015 14:19
Only display field and label if value exists
<?php
$company_description = get_company_field( 'company_description' );
if( $company_description ):
?>
<h4><?php _e( 'About Us', 'petsitter' ); ?></h4>
<?php
echo $company_description;
endif;
?>
@tripflex
tripflex / gist:b247f29301907c0f18d1
Last active August 29, 2015 14:19
Add custom field button next on header image of Listify theme
<?php
function custom_listify_single_job_listing_actions_after() {
global $post;
$url = get_post_meta( $post->ID, '_company_website', true );
$offerta_url = get_post_meta( $post->ID, '_company_offerta', true );
if( $offerta_url ) echo "<a href=\"" . esc_url( $url ) . "\" class=\"button\" target=\"_blank\">VAI ALL 'OFFERTA</a>";
echo '<a href="' . esc_url( $url ) . '" class="button" target="_blank">Vai al sito</a>';
@tripflex
tripflex / gist:c8e536f544dfce0ca008
Created May 4, 2015 22:22
Show image with link only if field has value
<?php
$shop_url = get_custom_field( 'shop_url' );
if( ! empty( $shop_url ) ){
echo "<a href=\"" . esc_url( $shop_url ) . "\" target=\"_blank\"><img src=\"//domain.com/banners/gotoshop.jpg\"></a>";
}
@tripflex
tripflex / job-submit.php
Created May 16, 2015 19:43
Output company fields before job fields (custom template override)
<?php
/**
* Job Submission Form
*/
if ( ! defined( 'ABSPATH' ) ) exit;
global $job_manager;
?>
<form action="<?php echo esc_url( $action ); ?>" method="post" id="submit-job-form" class="job-manager-form" enctype="multipart/form-data">
@tripflex
tripflex / gist:8dd22c6a3b7472ec3461
Last active August 29, 2015 14:21
Output twitter link from username
<?php
$twitter_username = get_custom_field('company_twitter');
if( ! empty( $twitter_username ) ) {
$clean_twitter = sanitize_text_field( $twitter_username );
// Check for http: or https: in $clean_twitter
if ( $clean_twitter && ! strstr( $clean_twitter, 'http:' ) && ! strstr( $clean_twitter, 'https:' ) ) {
// Check if twitter.com is not in string (means they used username only)
if( ! strstr( $clean_twitter, 'twitter.com' ) ){
$clean_twitter = "https://twitter.com/{$clean_twitter}";
} else {
@tripflex
tripflex / gist:d9a0c34faa08bfda1bfa
Created May 29, 2015 20:13
Remove field from education resume fields (this example removes qualifications)
<?php
add_filter( 'resume_manager_resume_education_fields', 'my_custom_remove_education_field_admin' );
add_filter( 'submit_resume_form_fields', 'my_custom_remove_education_field_frontend' );
function my_custom_remove_education_field_admin( $fields ){
unset( $fields['qualification'] );
return $fields;
@tripflex
tripflex / railgun.conf
Created June 2, 2015 23:40
Default CloudFlare RailGun railgun.conf file (/etc/railgun/railgun.conf)
# Port to listen on
wan.port = 2408
# Static map of IPs for use in NAT environments
map.file = /etc/railgun/railgun-nat.conf
stderr.file = /var/log/railgun/panic.log
pid.file = /var/run/railgun/railgun.pid
# Log only errors by default
#
@tripflex
tripflex / content-job_listing.php
Created June 4, 2015 16:38
Example of adding custom PHP field output on Job List page
<?php global $post; ?>
<li <?php job_listing_class(); ?> data-longitude="<?php echo esc_attr( $post->geolocation_lat ); ?>" data-latitude="<?php echo esc_attr( $post->geolocation_long ); ?>">
<a href="<?php the_job_permalink(); ?>">
<?php the_company_logo(); ?>
<div class="position">
<!-- This is the Job Title -->
<h3><?php the_title(); ?></h3>
<div class="company">
<?php the_company_name( '<strong>', '</strong> ' ); ?>
<?php the_company_tagline( '<span class="tagline">', '</span>' ); ?>