Skip to content

Instantly share code, notes, and snippets.

Avatar

Spencer Finnell spencerfinnell

View GitHub Profile
@spencerfinnell
spencerfinnell / functions.php
Created Oct 16, 2017 — forked from rali14/functions.php
force autolocation on homepage only
View functions.php
function listify_custom_autolocation() {
if ( ! ( is_front_page() ) ) {
return;
}
if ( isset( $_GET['search_location'] ) ) {
return;
}
?>
<script>
View function.php
<?php
// Add your own function to filter the fields
add_filter( 'submit_job_form_fields', 'remove_listify_submit_job_form_fields', 9999 );
// This is your function which takes the fields, modifies them, and returns them
function remove_listify_submit_job_form_fields( $fields ) {
if( ! isset( $fields['job'] ) ) {
return $fields;
}
@spencerfinnell
spencerfinnell / functions.php
Last active Oct 3, 2016 — forked from tripflex/functions.php
Automatically set/assign parent taxonomy terms for hierarchical taxonomies in WordPress
View functions.php
<?php
add_action( 'set_object_terms', 'auto_set_parent_terms', 9999, 6 );
/**
* Automatically set/assign parent taxonomy terms to posts
*
* This function will automatically set parent taxonomy terms whenever terms are set on a post,
* with the option to configure specific post types, and/or taxonomies.
*
@spencerfinnell
spencerfinnell / style.css
Created Jul 5, 2016 — forked from rali14/style.css
Custom Icon for Custom Field Widget
View style.css
#jmfe_widget-2 > h2:before { /* Replace the ID (jmfe_widget-2) with the widget ID from Step 1 */
content: '\f35b'; /* replace the content here with the icon you would like to use.*/
display: inline-block;
font-family: Ionicons;
speak: none;
font-style: normal;
font-weight: 400;
font-variant: normal;
text-transform: none;
text-rendering: auto;
@spencerfinnell
spencerfinnell / functions.php
Last active May 5, 2016 — forked from rali14/functions.php
Display the username instead of first name on Account menu item
View functions.php
function custom_menu_item_name( $display, $user ) {
return $user->user_login;
}
add_filter( 'listify_acount_menu_user_label', custom_menu_item_name, 10, 2 );
@spencerfinnell
spencerfinnell / functions.php
Last active Jan 10, 2018 — forked from rali14/functions.php
Order Listings Randomly
View functions.php
<?php
/**
* Order items alphabetically.
*
* Remove the <?php tag if it already exists in your functions.php file.
*/
add_action( 'init', function() {
add_filter( 'get_job_listings_query_args', function( $query_args, $args = array() ) {
$query_args['orderby'] = array( 'title' => 'ASC', 'menu_order' => 'ASC' );
return $query_args;
View functions.php
function limit_upload_size_limit_for_non_admin( $limit ) {
if ( ! current_user_can( 'manage_options' ) ) {
$limit = '1000000'; // 1mb in bytes
}
return $limit;
}
add_filter( 'upload_size_limit', 'limit_upload_size_limit_for_non_admin' );
View style.css
.type-job_listing .job_listing-entry-header .job_listing-location.job_listing-location-formatted {
display: none;
}
View gist:5f5b71b3b2d42c3e408c
// Hook into user_has_cap filter. This assumes you have setup resumes to require the capability 'has_active_job'
add_filter( 'user_has_cap', 'has_active_job_capability_check', 10, 3 );
/**
* has_active_job_package_capability_check()
*
* Filter on the current_user_can() function.
*
* @param array $allcaps All the capabilities of the user
* @param array $cap [0] Required capability
View gist:3915040
<?php
/**
* Upgrade Functions
*
* @package Easy Digital Downloads
* @subpackage Download Functions
* @copyright Copyright (c) 2012, Pippin Williamson
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
* @since 1.3.1
You can’t perform that action at this time.