Skip to content

Instantly share code, notes, and snippets.

// [quotable]"Here's my quote."[/quotable]
// [quotable link="" class="" link_class=""]"Here's my quote."[/quotable]
// if link says 'no', use only content, no permalink
//=========================================================== TWEET THIS SHORTCODE
function quotable_shortcode( $atts, $content = null ) {
extract(shortcode_atts(array(
'class' => 'no_lede',
'link' => '',
'link_class' => '',
), $atts));
@chasereeves
chasereeves / Wordpress Function: Social Meta Tags for Open Graph.php
Created November 24, 2015 17:18
Wordpress Function: Social Meta Tags for Open Graph
function insert_fb_in_head() {
global $post;
if ( !is_singular()) return;
$meta = strip_tags($post->post_content);
$meta = strip_shortcodes($post->post_content);
$meta = str_replace(array("\n", "\r", "\t"), ' ', $meta);
$meta = substr($meta, 0, 125);
$meta = strip_tags($meta);
// basics, same for all
@chasereeves
chasereeves / gist:2a36fd3cf02844eef47f
Created March 4, 2015 19:59
Fizzle Soundcloud Shortcode
// [podsc url="069-work-for-yourself-or-for" hrtop="" hrbottom="" btn_top=""]
function podsc($atts) {
extract(shortcode_atts(array(
"url" => '',
"hrtop" => 'true',
"hrbottom" => 'true',
"btn_top" => ''
), $atts));
// remove intro bits of URL if it's in the shortcode
<?php
//=========================================================== Grab first paragraph (two if first is not long enough)
function get_first_two_paragraphs(){
global $post;
$str = wpautop( get_the_content() );
$psToGrab = 2; // number of paragraphs to get
$maxFirstParaLength = 200; // character max in first paragraph
$matches = array(); // matching elements will go here
$pattern = '%<p[^>]*>(.*?)</p>%i'; // match what's between all <p> tags
preg_match_all($pattern, $str, $matches); // do the regex match
<?
//=========================================================== SUBSCRIBER SHORTCODE
function subscriber_shortcode($atts, $content = null ) {
extract(shortcode_atts(array(
'page' => '',
'headline' => 'Subscribe for free updates',
'button' => 'Subscribe',
'quote' => '',
'class' => 'box_main',
'form_class' => 'centered_form',
//=========================================================== PODLISTEN SHORTCODE
add_shortcode('podlisten', 'podlisten_shortcode');
// example: [podlisten src="http://your-site/videos/your-audio.mp3"]
function podlisten_shortcode($atts, $content = null) {
extract(shortcode_atts(array(
"src" => ''
), $atts));
return '
<div class="podlisten">
@chasereeves
chasereeves / gist:7093132
Created October 22, 2013 00:11
Wordpress shortcode for podcast file.
//=========================================================== PODLISTEN SHORTCODE
add_shortcode('podlisten', 'podlisten_shortcode');
// example: [podlisten src="http://your-site/videos/your-audio.mp3"]
function podlisten_shortcode($atts, $content = null) {
extract(shortcode_atts(array(
"src" => ''
), $atts));
return '
<hr class="big"/>
@chasereeves
chasereeves / gist:7093097
Created October 22, 2013 00:07
wordpress: Get first paragraph (first two if paragraph #1 isn't long enough).
//=========================================================== Grab first paragraph (two if first is not long enough)
function get_first_two_paragraphs(){
global $post;
$str = wpautop( get_the_content() );
$psToGrab = 2; // number of paragraphs to get
$maxFirstParaLength = 200; // character max in first paragraph
$matches = array(); // matching elements will go here
$pattern = '%<p[^>]*>(.*?)</p>%i'; // match what's between all <p> tags
preg_match_all($pattern, $str, $matches); // do the regex match
$outparts = array_slice($matches[1], 0, $psToGrab); // chop off everything after the first 2 elements
jQuery('a[href$="mp3"]').each(function(){
var audioURL = jQuery(this).attr('href');
var audioName = jQuery(this).text();
jQuery(this).before('<br/>');
jQuery(this).after('<br/><audio controls src="'+audioURL+'" type="audio/mpeg" preload="none"></audio><br/>');
});

Web Design & Development Contract

Between us COMPANY_NAME and you CUSTOMER_NAME on DATE_DATE.

Summary:

We'll always do our best to fulfill your needs and meet your expectations, but it's important to have things written down so that we both know who should do what, when, and what we'll do if something goes wrong. In this contract you won't find any complicated legal terms or long passages of unreadable text. We have no desire to trick you into signing something that you might later regret. What we do want is what's best for both parties, now and in the future.