Skip to content

Instantly share code, notes, and snippets.

/**
* add this to the functions.php file in your theme to disable fb comments open graph metadata
*/
add_filter('fbc_og_tags', '__return_false');
/**
* If you cannot clean up your open graph meta tags, adding this filter to the functions.php file in your theme will keep
* SharePress from verifying the open graph data.
* Caution: Bad use of open graph meta tags could possibly cause unexpected results in shared images and titles on facebook.
*/
add_filter('sp_auto_flush_fb', '__return_false');
@joeyblake
joeyblake / gist:9474346
Created March 10, 2014 21:08
responsive facebook comments
.fb-comments, .fb-comments iframe[style] {
width: 100% !important;
}
@joeyblake
joeyblake / gist:9622208
Created March 18, 2014 15:22
Customizing SharePress og:meta tags with custom fields
//Add this to your theme's functions.php file
//Modify the function to add the custom field value you are looking for
add_filter('sharepress_og_tags', 'my_sharepress_og_tags');
function my_sharepress_og_tags( $og ) {
global $post;
$custom_value = get_post_meta($post->ID, 'your custom field name', true);
$og = array_merge($og, array(
'og:title' => $og['og:title'] . " " . $custom_value
@joeyblake
joeyblake / gist:2f7264d3070d51732fa8
Created November 1, 2014 14:46
SharePress replace open graph meta data filter
//Add this to your theme's functions.php file
//Modify the function to add the custom field value you are looking for
add_filter('sharepress_og_tags', 'my_sharepress_og_tags');
function my_sharepress_og_tags( $og ) {
global $post;
$stripped_quotes = str_replace( '"', '', $og['og:title'] );
$og = array_merge($og, array(
'og:title' => $strip_quotes
@joeyblake
joeyblake / gist:519673dec628784f689e
Created February 20, 2015 21:32
Mapping Multiple authors on a WordPress data import browser snippet
jQuery('select[name*="user_map"]').each(function(idx, el){
var $select = jQuery(el),
$parent = jQuery(el).parent().parent(),
$strong = $parent.find('strong'),
name = $strong.text().split(' (')[0].trim(),
val = $select.find('option').filter(function () { return jQuery(this).html() == name; }).val();
if ( val !== undefined ) {
$select.val(val);
} else {
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
@joeyblake
joeyblake / Sample multiple 301 redirects in Ghost
Created January 30, 2014 04:31
Multiple 301 redirects in Ghost
server.get('/*', function(req, res, next) {
var fullURL = req.protocol + "://" + req.get('host') + req.url;
//your 301 redirects
var redirects_301 = {
'http://thinkingandmaking.com/working/92/72-questions-to-ask-on-your-first-day': '/view/72-questions-to-ask-on-your-first-day',
'http://thinkingandmaking.com/working/92/someother': '/view/someother'
}
//check and see if there is a redirect, if so, redirect to it!
if (redirects_301[fullURL]) {
res.redirect(301, redirects_301[fullURL]);
@joeyblake
joeyblake / gist:1147634
Created August 15, 2011 19:55
Sample JSON
{
"swap": {
"your_dtString": {
"current": 12000,
"max": 234234
},
"your_dtString": {
"current": 12000,
"max": 234234
}
@joeyblake
joeyblake / gist:1147632
Created August 15, 2011 19:55
Sample JSON
{
"swap": {
"your_dtString": {
"current": 12000,
"max": 234234
},
"your_dtString": {
"current": 12000,
"max": 234234
}