Skip to content

Instantly share code, notes, and snippets.

View mattradford's full-sized avatar
👋

Matt Radford mattradford

👋
View GitHub Profile
# Contract Killer
### The popular open-source contract for web designers and developers by [Stuff & Nonsense](http://stuffandnonsense.co.uk/)
* Originally published: 23/12/2008
* Revised date: 15/12/2013
* [Original post](http://stuffandnonsense.co.uk/projects/contract-killer/)
* * *

Contract Killer

The popular open-source contract for web designers and developers by Stuff & Nonsense

  • Originally published: 23/12/2008
  • Revised date: 15/12/2013
  • Original post

@mattradford
mattradford / custom_user_photo.php
Created August 12, 2014 23:28
WordPress - custom user photo from user login name (via custom field)
<?php
$username = get_sub_field('team_member_username');
$the_user = get_user_by('login', $username);
$the_user_id = $the_user->ID;
$user_photo = get_user_meta($the_user_id, 'your_photo', true);
$image_src = wp_get_attachment_image_src($user_photo);
echo '<img class="author-picture" src="'. $image_src[0] .'" />';
?>
@mattradford
mattradford / wp_custom_author_header.php
Last active August 29, 2015 14:05
WordPress - show an author bio using a custom photo, on an author page
<?php
$curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));
?>
<h1><?php echo $curauth->display_name; ?>'s blog</h1>
<?php
$publisher_photo = get_the_author_meta('your_photo');
$image_src = wp_get_attachment_image_src($publisher_photo);
@mattradford
mattradford / share-linkedin
Created August 22, 2014 08:37
WordPress Linked share button without JS
<a href="http://www.linkedin.com/shareArticle?mini=true&url=<?php the_permalink() ?>&title=<?php the_title(); ?>&summary=&source=<?php bloginfo('name'); ?>" target="_new">
@mattradford
mattradford / .calc-width
Last active August 29, 2015 14:05
LESS mixin to calculate a width
.calc-width(@margin, @fallback) {
width: @fallback;
width: -o-calc(~"100% - "@margin);
width: -webkit-calc(~"100% - "@margin); /** Safari 6, Chrome 19-25 **/
width: -moz-calc(~"100% - "@margin); /** FF 4-15 **/
width: calc(~"100% - "@margin); /** FF 16+, IE 9+, Opera 15, Chrome 26+, Safari 7 and future other browsers **/
/* See http://caniuse.com/#search=calc for known issues with calc */
}
@mattradford
mattradford / jquery.move.elements
Created September 14, 2014 15:10
Moving elements around in the header
$(document).ready(function() {
// Store the references outside the event handler:
var $window = $(window);
var $pane1 = $('#search-dropdown');
var $pane2 = $('.social-icons');
function checkWidth() {
var windowsize = $window.width();
if (windowsize > 768) {
$pane1.detach().insertAfter('.logo-container');
@mattradford
mattradford / 0_reuse_code.js
Last active August 29, 2015 14:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
function mattrad_remove_script_version( $src ){
return remove_query_arg( 'ver', $src );
}
add_filter( 'script_loader_src', 'mattrad_remove_script_version' );
add_filter( 'style_loader_src', 'mattrad_remove_script_version' );