Skip to content

Instantly share code, notes, and snippets.

View nszumowski's full-sized avatar
🏠
doin' stuff

Nick Szumowski nszumowski

🏠
doin' stuff
  • Burlington, VT
  • 00:45 (UTC -04:00)
View GitHub Profile
@nszumowski
nszumowski / gist:dd749d878d822948654cf1f42d3ac09f
Last active July 18, 2017 18:16 — forked from spencerfinnell/gist:71910ea539cb75187c8d988059ae367a
WP Job Manager - Jobify Theme - extended location plugin update
add_filter( 'wpjmel_ip_location_string', function( $string, $data ) {
return $data['city'] . ', ' . $data['region'];
}, 1, 2 );
// http://ip-api.com/json
$url = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
if (strpos($url,'car') !== false) {
echo 'Car exists.';
} else {
echo 'No cars.';
}
@nszumowski
nszumowski / typekit-functions.php
Created April 22, 2016 16:41
typekit in wordpress functions.php
// Typekit
function themexxx_typekit() {
wp_enqueue_script( 'typekit', '//use.typekit.net/xxxxxx.js');
}
add_action( 'wp_enqueue_scripts', 'themexxx_typekit' );
function themexxx_typekit_inline() {
if ( wp_script_is( 'typekit', 'done' ) ) { ?>
<script type="text/javascript">try{Typekit.load({ async: true });}catch(e){}</script>
<?php }
}
@nszumowski
nszumowski / concat-filename-paths.mysql
Last active April 22, 2016 16:46
concat and store columns mysql
UPDATE audio_files set mp3_path = CONCAT(audio_files.path, audio_files.filename);
@nszumowski
nszumowski / wp-menu-shortcodes.php
Last active October 23, 2023 18:35
WordPress Menu Shortcodes
//Basic:
function print_menu_shortcode($atts, $content = null) {
extract(shortcode_atts(array( 'name' => null, ), $atts));
return wp_nav_menu( array( 'menu' => $name, 'echo' => false ) );
}
add_shortcode('menu', 'print_menu_shortcode');
//Place this in functions.php, then use [menu name="main-menu"] to call the menu in your content (replacing "main-menu" with your menu’s slug, of course).
//http://stephanieleary.com/2010/07/call-a-navigation-menu-using-a-shortcode/
@nszumowski
nszumowski / awesome-wordpress-favicons.php
Last active April 22, 2016 16:46 — forked from jhned/awesome-wordpress-favicons
Ever wanted to set up custom favicons in the WordPress admin or on the WordPress login screen? Well, now you can.
// First, create a function that includes the path to your favicon
function add_favicon() {
$favicon_url = get_stylesheet_directory_uri() . '/images/icons/admin-favicon.ico';
echo '<link rel="shortcut icon" href="' . $favicon_url . '" />';
}
// Now, just make sure that function runs when you're on the login page and admin pages
add_action('login_head', 'add_favicon');
add_action('admin_head', 'add_favicon');