Skip to content

Instantly share code, notes, and snippets.

Avatar
👋

Matt Radford mattradford

👋
View GitHub Profile
@mattradford
mattradford / tax_title.php
Created August 26, 2015 13:20
Return taxonomy title. For lib/titles.php
View tax_title.php
} elseif (is_tax('flooring-type')) {
$queried_object = get_queried_object();
return $queried_object->name;
@mattradford
mattradford / acf_image_array.php
Created August 27, 2015 12:20
ACF - display image and alt text
View acf_image_array.php
(1)
<?php
$imageArray = get_field('footer_logo', 'options');
$imageAlt = $imageArray['alt'];
$imageURL = $imageArray['sizes']['thumbnail'];
?>
<img src="<?php echo $imageURL;?>" alt="<?php echo $imageAlt; ?>">
(2)
<?php
View Web Design contract
# 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/)
* * *
View Contract Killer 3.md

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

View fa-icon-external-link.css
@mattradford
mattradford / custom_user_photo.php
Created August 12, 2014 23:28
WordPress - custom user photo from user login name (via custom field)
View custom_user_photo.php
<?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
View wp_custom_author_header.php
<?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
View share-linkedin
<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
View .calc-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
View jquery.move.elements
$(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');