Skip to content

Instantly share code, notes, and snippets.

View collegeman's full-sized avatar

Aaron Collegeman collegeman

View GitHub Profile
<?php
add_filter('sharepress_supported_post_types', '__my_sharepress_supported_post_types');
function __my_sharepress_supported_post_types($types) {
$types[] = 'bgmp';
return $types;
}
add_filter('filter_sharepress_meta', '__my_filter_sharepress_meta', 10, 3);
function __my_filter_sharepress_meta($meta, $post) {
if ($post->post_type == 'bgmp') {
@collegeman
collegeman / fix-missed-schedule.php
Created April 16, 2012 02:05
A simple drop-in for fixing Missed Schedules in WordPress
<?php
// Based on: http://wordpress.org/extend/plugins/wp-missed-schedule/
@define('MISSED_SCHEDULE_DELAY', 5);
@define('MISSED_SCHEDULE_OPTION', 'wp_missed_schedule');
function fix_missed_schedule() {
global $wpdb;
// check to see if the publishing window is up again...
<?php
add_filter('sharepress_og_tag_title', '__my_sharepress_og_tag_title', 10, 3);
function __my_sharepress_og_tag_title($content, $post, $meta) {
$content = 'My custom title';
return $content;
}
<?php
add_filter('sharepress_og_tags', '__my_sharepress_og_tags', 10, 3);
function __my_sharepress_og_tags($og, $post, $meta) {
$og['og:title'] = 'My custom title';
$og['og:description'] = 'My custom description';
return $og;
}
@collegeman
collegeman / youtube-shortcode.php
Created March 6, 2012 17:03 — forked from coreyweb/youtube-shortcode.php
Youtube shortcode for WordPress
<?php
/**
* Youtube Shortcode Solution
*
* Set your desired width for all the videos on your site (below)
* Paste any Youtube video link in the shortcode, using this format, i.e.:
* [youtube value="http://www.youtube.com/watch?feature=player_embedded&v=GGT8ZCTBoBA"]
* This code will automatically resize your video to the appropriate size and aspect ratio.
* Modify the width value (set to 590 here), and the iframe code below to your desired settings.
* This requires coreylib (coreylib.com)
@collegeman
collegeman / format-tail.sh
Created March 1, 2012 01:21
Add color formatting to a tail stream
tail -f file | perl -pe 's/(ERROR|WARN)/\e[1;31;43m$&\e[0m/g'
@collegeman
collegeman / custom-post-types.php
Created February 16, 2012 16:30
Custom configurations for SharePress
<?php
add_filter('sharepress_supported_post_types', '__my_sharepress_supported_post_types');
function __my_sharepress_supported_post_types($types) {
// Want to add SharePres support to a Page? Uncomment this line:
//$types[] = 'page';
// Want to add SharePress support to custom post types? List them thusly:
$types[] = 'my_custom_type_1';
$types[] = 'my_custom_type_2';
@collegeman
collegeman / mu.php
Created December 29, 2011 22:18
Filtering the list of Targets for SharePress
<?php
add_filter('sharepress_ok_page_names', '__my_sharepress_ok_page_names');
function __my_sharepress_ok_page_names($pages) {
$current_site = get_current_site();
if ($current_site->blog_id == 1) {
return array('OK Page Title for Blog #1');
} else if ($current_site->blog_id == 2) {
return array('OK Page Title for Blog #2');
} else {
return $pages; // your default might be none, by way of array()
<?php
// usage: Dashboard_MobileDetect::is(); // == true when mobile, otherwise false
#
# Mobile Detect
# @see http://code.google.com/p/php-mobile-detect/
# @license http://www.opensource.org/licenses/mit-license.php The MIT License
##
class Dashboard_MobileDetect {
@collegeman
collegeman / example-plugin.php
Created November 22, 2011 06:17
Baseclass for writing WordPress plugins that need to implement an oAuth workflow
<?php
require('wordpress-oauth-support.php');
class YourPluginNamespace extends YourPluginNamespace_WordPressOAuthSupport {
function __construct() {
add_action('init', array($this, 'init'));
}
function init() {