Skip to content

Instantly share code, notes, and snippets.

View wpsmithtwc's full-sized avatar

Travis Smith wpsmithtwc

View GitHub Profile
<?php
/*
Plugin Name: Custom META Tags
Description: Add custom META tags on a per-page/post basis using custom fields.
Author: Keith Solomon
Version: 1.0
Author URI: http://solowebdesigns.net/
*/
@wpsmithtwc
wpsmithtwc / Google Blogger Social Meta Tags.html
Created October 6, 2016 16:07 — forked from milanaryal/Google Blogger Social Meta Tags.html
Google Blogger/BlogSpot Social Meta Tags for Facebook, Twitter, Google+, Pinterest [v1.0]
<!-- add the following code in the head tag -->
<head prefix='og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# article: http://ogp.me/ns/article#'>
<!-- Share Image -->
<link href='YOUR_LOGO_IMAGE' rel='image_src'/>
<!-- Open Graph Meta Tags -->
<b:if cond='data:blog.pageType != &quot;index&quot;'>
<meta expr:content='data:blog.title' property='og:site_name'/>
@wpsmithtwc
wpsmithtwc / viewport-meta-in-20-best-responsive-designs.md
Created October 6, 2016 16:07 — forked from andreasbovens/viewport-meta-in-20-best-responsive-designs.md
Viewport meta tags used by the 20 sites that are listed in Social Driver's "20 Best Responsive Web Design Examples of 2012"

Intro

http://socialdriver.com/2012/07/20-best-responsive-websites/ lists 20 sites that are supposedly best-in-class when it comes to responsive design techniques. I had a look at the viewport meta tags used in these sites.

Findings

  • All sites use width=device-width, with in most cases an additional initial-scale=1. This is good practice.

However:

  • 8 sites turn off pinch-zooming by setting maximum-scale to 1, or using user-scalable=no. While there are some corner use cases for this, it does not make sense to do this on text-heavy sites as it impairs accessibility.
  • 3 sites use semi-colons as delimiters between viewport values. While this works in newer mobile browsers, it's not officially supported, and breaks in older mobile browser versions.
  • 1 site has 2 viewport meta tags (with different values) in the source...
@wpsmithtwc
wpsmithtwc / metas.md
Created October 6, 2016 16:07 — forked from tcelestino/metas.md
meta tags

#Meta Tags

<!---favicon-->
<link rel="icon" href="http://www.example.com/favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="http://www.example.com/favicon.ico" type="image/x-icon">

<!--Apple Touch Icon for iPad and iPhone Meta Tag-->
<link rel="apple-touch-icon" href="http://www.example.com/apple-touch-icon.png">
<link rel="apple-touch-icon-precomposed" href="http://www.example.com/apple-touch-icon.png">
@wpsmithtwc
wpsmithtwc / custom_json.go
Created October 14, 2016 15:27 — forked from mdwhatcott/custom_json.go
Example of implementing MarshalJSON and UnmarshalJSON to serialize and deserialize custom types to JSON in Go. Playground: http://play.golang.org/p/7nk5ZEbVLw
package main
import (
"bytes"
"encoding/json"
"fmt"
"strconv"
)
func main() {
@wpsmithtwc
wpsmithtwc / search.html
Created October 17, 2016 16:55 — forked from flohei/search.html
An example search page for Jekyll running the jekyll-lunr-js-search plugin.
---
layout: default
permalink: /search/
---
<!--
http://10consulting.com/2013/03/06/jekyll-and-lunr-js-static-websites-with-powerful-full-text-search-using-javascript/
-->
<div class="home">
curl -H "Fastly-Debug: true" -H "Fastly-No-Shield: true" -I https://domain.com/path/to/file.ext
@wpsmithtwc
wpsmithtwc / archive-speaking_event.php
Created December 28, 2016 00:21 — forked from jdevalk/archive-speaking_event.php
Genesis helper code for schema
<?php
add_filter( 'genesis_attr_content', 'yoast_schema_empty', 20 );
add_filter( 'genesis_attr_entry', 'yoast_schema_event', 20 );
add_filter( 'genesis_attr_entry-title', 'yoast_itemprop_name', 20 );
add_filter( 'genesis_attr_entry-content', 'yoast_itemprop_description', 20 );
add_filter( 'genesis_post_title_output', 'yoast_title_link_schema', 20 );
/**
* We'll use the post info output to add more meta data about the event.
@wpsmithtwc
wpsmithtwc / acf-field-snitch-v5.js
Created December 29, 2016 19:00 — forked from bryanwillis/acf-field-snitch-v5.js
Fix for advanced-custom-field "Fields Snitch" plugin to work with version 5 of ACF
jQuery(function($) {
var prevInit = false;
var initialize = function() {
listenKeyboard();
};
var listenKeyboard = function() {
var timesHit = 0;
@wpsmithtwc
wpsmithtwc / acf-auto-export.php
Created December 30, 2016 02:34 — forked from raideus/acf-auto-export.php
This collection of functions completely automates the "Export to PHP" feature of Advanced Custom Fields. No more manual copy + pasting! Simply specify an absolute file path (line 17) and the code will automatically write the ACF data to the file. The export is initiated whenever you publish a new field group or save changes to an existing field …
<?php
/**
* Automated PHP export for Advanced Custom Fields
*
* Export is initiated whenever an admin publishes a new field group
* or saves changes to an existing field group.
*
* Place this code in your theme's functions.php file.
*
*/