Skip to content

Instantly share code, notes, and snippets.

🤓
in the zone

Myles McNamara tripflex

🤓
in the zone
Block or report user

Report or block tripflex

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tripflex
tripflex / functions.php
Created Jan 7, 2020
Auto Populate file field from Ultimate Member Profile/Avatar when using WP Job Manager Field Editor
View functions.php
<?php
add_filter( 'field_editor_auto_populate_company_logo', 'smyles_auto_populate_get_um_user_profile' );
function smyles_auto_populate_get_um_user_profile( $value ){
$user_id = get_current_user_id();
// Set user ID
um_fetch_user( $user_id );
@tripflex
tripflex / functions.php
Created Jan 4, 2020
Set job_location field from other field values (to separate job_location into multiple fields)
View functions.php
<?php
add_action( 'submit_job_form_start', 'smyles_auto_set_job_location' );
function smyles_auto_set_job_location() {
echo "
<script>
jQuery( function( $ ){
function smyles_update_job_location(){
@tripflex
tripflex / HideEmail.vue
Created Dec 17, 2019
Hide/Obfuscate/Mask Email Address from Spam Bots (Vue.js Component)
View HideEmail.vue
<template>
<span class="reverse">{{reversedEmail}}</span>
</template>
<script>
export default {
name: 'hide-email',
props: [ 'email' ],
computed: {
reversedEmail(){
@tripflex
tripflex / functions.php
Last active Dec 13, 2019
Prepend username on any files uploaded with WP Job Manager
View functions.php
<?php
add_filter( 'job_manager_upload_file_pre_upload', 'smyles_add_user_login_to_file_uploads' );
function smyles_add_user_login_to_file_uploads( $file ) {
$user = wp_get_current_user();
if ( $user && $user->ID > 0 ) {
$file['name'] = sanitize_file_name( $user->user_login ) . '_' . $file['name'];
}
@tripflex
tripflex / functions.php
Created Dec 2, 2019
Disable "Save Draft" button when using WP Job Manager
View functions.php
<?php
add_filter( 'submit_job_form_can_continue_later', '__return_false' );
@tripflex
tripflex / job-submit.php
Last active Dec 3, 2019
Move specific company fields into Job Fields section below a specific Job Field
View job-submit.php
<?php
/**
* Content for job submission (`[submit_job_form]`) shortcode.
*
* This template can be overridden by copying it to yourtheme/job_manager/job-submit.php.
*
* @see https://wpjobmanager.com/document/template-overrides/
* @author Automattic
* @package wp-job-manager
* @category Template
@tripflex
tripflex / functions.php
Last active Dec 2, 2019
Set max slug characters for custom permalink handling when using WP Job Manager Visibility
View functions.php
<?php
add_filter( 'job_manager_visibility_job_permalink_max_slug_chars', 'smyles_set_max_permalink_characters', 10, 4 );
add_filter( 'job_manager_visibility_admin_job_permalink_max_slug_chars', 'smyles_set_max_permalink_characters', 10, 4 );
add_filter( 'job_manager_visibility_resume_permalink_max_slug_chars', 'smyles_set_max_permalink_characters', 10, 4 );
add_filter( 'job_manager_visibility_admin_resume_permalink_max_slug_chars', 'smyles_set_max_permalink_characters', 10, 4 );
function smyles_set_max_permalink_characters( $max, $meta_key, $field_value, $structure ){
return 100;
}
@tripflex
tripflex / functions.php
Created Nov 25, 2019
Automatically set/assign child taxonomy terms for hierarchical taxonomies in WordPress (job listings, with job_listing_category taxonomy)
View functions.php
<?php
add_action( 'set_object_terms', 'auto_set_child_terms', 9999, 6 );
/**
* Automatically set/assign child taxonomy terms to posts
*
* This function will automatically set child taxonomy terms whenever a parent term is set on a post,
* with the option to configure specific post types, and/or taxonomies.
*
*
* @param int $object_id Object ID.
@tripflex
tripflex / functions.php
Last active Nov 27, 2019
Enable Featured Image (thumbnail) for WP Job Manager Resumes
View functions.php
<?php
add_filter( 'register_post_type_resume', 'register_post_type_resume_enable_featured_image' );
// Unfortunately all reusme uploads must be attached (added to media library) to support featured image
add_filter( 'resume_manager_attach_uploaded_files', '__return_true' );
function register_post_type_resume_enable_featured_image( $post_type ) {
if( ! in_array( 'thumbnail', $post_type['supports'] ) ){
$post_type['supports'][] = 'thumbnail';
}
@tripflex
tripflex / functions.php
Last active Nov 21, 2019
Output full URL for specific meta keys when using Output As link with WP Job Manager Field Editor
View functions.php
<?php
add_filter( 'job_manager_field_editor_output_as_link_output_caption', 'smyles_output_link_full_url', 10, 5 );
function smyles_output_link_full_url( $caption, $meta_key, $field_value, $args, $listing_id ){
$full_url_meta_keys = array( 'teacher_website' );
if( ! in_array( $meta_key, $full_url_meta_keys ) ){
return $caption;
}
You can’t perform that action at this time.