Skip to content

Instantly share code, notes, and snippets.

View aaronranard's full-sized avatar

Aaron Ranard aaronranard

View GitHub Profile
@aaronranard
aaronranard / edit-custom-category-list.php
Created July 23, 2013 20:04
WordPress: Edit Category / Post List
//Edit the Category List
add_filter( 'manage_edit-post_type_columns', 'set_custom_edit_post_type_columns' );
// Add to admin_init function
add_filter( 'manage_post_type_custom_column', 'manage_post_type_columns', 10, 3);
function manage_post_type_columns($out, $column_name, $id) {
switch ($column_name) {
case 'icon_image':
// Output custom post_type field here
@aaronranard
aaronranard / address-to-lat-long.php
Created July 23, 2013 15:13 — forked from bradp/gist:4999343
WordPress: Address to Latitude / Longitude
<?php
function brrad_geocode($street_address,$city,$state){
$street_address = str_replace(" ", "+", $street_address); //google doesn't like spaces in urls, but who does?
$city = str_replace(" ", "+", $city);
$state = str_replace(" ", "+", $state);
$url = "http://maps.googleapis.com/maps/api/geocode/json?address=$street_address,+$city,+$state&sensor=false";
$google_api_response = wp_remote_get( $url );
@aaronranard
aaronranard / feature.php
Last active December 15, 2015 18:39
WordPress: Get the Featured Image
<?php if (has_post_thumbnail( $project->ID )) : ?>
<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $project->ID ), 'single-post-thumbnail' ); ?>
<img src="<?php echo $image[0]; ?>" alt="" />
<?php endif; ?>
@aaronranard
aaronranard / Mobile_Detect.php
Created March 29, 2013 15:32
PHP: Mobile Detect
<?php
/**
* MIT License
* ===========
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to