Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 <[email protected]>
* @link http://example.com
* @copyright 2014 Your Name
@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: [email protected]
License:
@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 / 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 / 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()};