Skip to content

Instantly share code, notes, and snippets.

@logoscreative
logoscreative / gist:3551863
Created August 31, 2012 11:55
"Select All" Code for Facebook Modals (Tested in Chrome)
javascript:elms=document.getElementsByName("checkableitems[]");for (i=0;i<elms.length;i++){if (elms[i].type="checkbox" )elms[i].click()};
@logoscreative
logoscreative / Adding TypeKit to WordPress Without a Plugin
Created December 4, 2012 16:34
Add TypeKit to WordPress without a plugin. Put this in your functions.php file.
/* Add TypeKit Fonts */
function logos_add_typekit() {
echo '<script type="text/javascript" src="//use.typekit.net/yourtypekitcode.js"></script>
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>';
}
add_filter( 'wp_head', 'logos_add_typekit' );
@logoscreative
logoscreative / infographic-embedder.php
Created April 9, 2013 15:47
Update Infographic Embedder plugin to support pages
function infographic_embedder_add_post_meta_boxes() {
add_meta_box(
'infographic_embedder-post-class',
__( 'Infographic Embed', 'example' ),
'infographic_embedder_post_class_meta_box',
'post',
'side',
'default'
);
add_meta_box(
@logoscreative
logoscreative / infographic-embedder.php
Created April 9, 2013 15:48
Update Infographic Embedder plugin to support pages (entire file)
<?php
/*
Plugin Name: Infographic Embedder
Plugin URI: http://pardot.com
Description: Takes the infographic URL and adds content to the end of posts.
Version: 1.0
Author: Cliff Seal (Pardot)
Author URI: http://pardot.com
Author Email: cliff.seal@pardot.com
License:
@logoscreative
logoscreative / admincleanup.php
Last active November 29, 2016 22:12
Sample Plugin for "Cleaning up the WordPress Admin"
<?php
/**
* Your Name Global Plugin
*
* Core settings for Your Name sites.
*
* @package core_yourplugin
* @author Your Name <you@email.com>
* @link http://example.com
* @copyright 2014 Your Name
@logoscreative
logoscreative / functions.php
Created March 27, 2014 11:00
Preview Genesis Child Theme Color Options
add_filter( 'body_class', 'yourtheme_preview_color' );
function yourtheme_preview_color($classes) {
if ( isset($_GET['color']) && !empty($_GET['color']) ) {
$current_theme = wp_get_theme();
$queried_theme = $current_theme->stylesheet;
array_push( $classes, $queried_theme . '-' . $_GET['color'] );
@logoscreative
logoscreative / functions.php
Created May 22, 2014 11:30
Add a Class Conditionally for WordPress Page Templates
function prefix_conditional_body_class($classes) {
if ( get_page_template_slug(get_the_ID()) === 'mytemplate.php' ) {
$classes[] = 'bg-dark';
}
return $classes;
}
add_filter( 'body_class', 'prefix_conditional_body_class' );
@logoscreative
logoscreative / events-calendar-pro.php
Last active August 29, 2015 14:10
Redirecting to Next Recurring Event Instance
if( !empty($get_recurrence_event->posts) && tribe_is_recurring_event($get_recurrence_event->posts[0]->ID) && get_post_status($get_recurrence_event->posts[0]) == 'publish' ){
$nextevent = '';
$now = strtotime('now');
foreach ( tribe_get_recurrence_start_dates($event->ID) as $eventinstance ) {
$upcoming = strtotime($eventinstance);
if ( $now < $upcoming ) {
$eventinstance = explode(" ", $eventinstance);
$nextevent = $eventinstance[0];
break;
}
<?php
/**
* Finds the the full filepath for /wp-load.php in a ancestor directory.
*
* Walks up the parent directory stack to locate wp-load.php.
* Used by files in plugins that need require() wp-load.php
* but that might not be stored exactly where expected.
*
* Works as long as the wp-load.php is found by traversing parent directories.
*
@logoscreative
logoscreative / functions.php
Created January 24, 2015 19:05
Hook Gravity Forms Submission Into Events Calendar Pro
/* Make Events Form Work Redux */
add_filter("gform_post_data", "mb_set_post_date", 10, 3);
function mb_set_post_date($post_data, $form, $entry){
if($form["id"] != 48)
return $post_data;
$startdate = $entry["69"];
$starttime = $entry["5"];