Skip to content

Instantly share code, notes, and snippets.

View kristarella's full-sized avatar

Kristen Symonds kristarella

View GitHub Profile
@kristarella
kristarella / wp_xfbml.php
Last active October 7, 2015 12:48
Add Facebook XFBML to WordPress theme HTML
<?php
function fb_xfbml_js() {
?>
<div id="fb-root"></div>
<script>
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
@kristarella
kristarella / angel.php
Created August 7, 2012 04:47
Angel Snippets
function custom_body_classes($classes) {
if (is_category('Videos'))
$classes[] = "videos";
return $classes;
}
add_filter('thesis_body_classes','custom_body_classes');
function no_sidebars() {
if (is_category('Videos'))
return false;
@kristarella
kristarella / large_headline.php
Created September 12, 2012 23:25
Thesis single post title above post & sidebars
function remove_headline() {
return (is_single()) ? false : true;
}
add_filter('thesis_show_headline_area', 'remove_headline');
function large_headline() {
global $wp_query;
$post_ID = $wp_query->post->ID;
if (is_single()) {
?>
@kristarella
kristarella / rm_html.htaccess
Created December 10, 2012 23:39
htaccess: remove .html without breaking stuff in WP dashboard
# strip '.html' off any requests except in the dashboard
RewriteBase /
RewriteCond %{REQUEST_URI} !^/?(wp-admin|wp-includes)/(.*)$
RewriteRule ^(.*)\.html$ http://example.com/$1 [R=301,L]
@kristarella
kristarella / gist:5104474
Created March 7, 2013 00:25
A little AppleScript to remove notes from any of your contacts that have them. You could also use contains "string" instead of is not qual to "" to remove specific notes.
tell application "Address Book"
set num to 0
repeat with i from 1 to (count every person)
if (note of person i) is not equal to "" then
set note of person i to ""
set num to num + 1
end if
end repeat
display dialog "Removed " & num & " notes." buttons {"OK"}
save
@kristarella
kristarella / remove_urls
Created March 7, 2013 00:40
Somewhere along the way in syncing and merging duplicate contacts etc. I ended up with boat loads of Google Profile links as people's home page in my contacts. Most of those people don't even use Google+, so it seemed a bit dumb. This script easily vamoosed them! Don't forget to change the conditional contains "google.com" if you want to remove …
tell application "Address Book"
set output to ""
repeat with this_person in every person
set numurl to count (urls of this_person)
if numurl > 0 then
set theurls to properties of urls of this_person
repeat with this_url in theurls
-- Capturing the urls and a new line
set output to output & (value of this_url as string) & return
if value of this_url contains "google.com" then
@kristarella
kristarella / cpt-tax-column.php
Created August 19, 2013 07:19
Function to add your custom taxonomy as a column in the All Posts view of a custom post type (where "location" is the custom post type and "state" is the taxonomy).
<?php
add_filter('manage_location_posts_columns' , 'add_post_columns');
add_action( 'manage_location_posts_custom_column' , 'state_column', 10, 2 );
function add_post_columns($columns) {
$columns['state'] = 'State/Territory';
return $columns;
}
@kristarella
kristarella / shortcode_in_wp-caption.php
Last active December 25, 2015 16:29
Parses shortcode in WordPress image captions
<?php
function nested_img_caption_shortcode($nada, $attr, $content = null) {
extract(
shortcode_atts(
array(
'id' => '',
'align' => 'alignnone',
'width' => '',
'caption' => ''
@kristarella
kristarella / auto_featured_image.php
Last active December 27, 2015 08:48
Automatically assign featured images to WordPress posts from the attached images.
@kristarella
kristarella / genesis_header_image.php
Created January 16, 2014 06:21
Genesis child theme: use an HTML image for your custom header image instead of CSS background.
<?php
$header = array(
'default-image' => get_stylesheet_directory_uri().'/images/pageone.png',
'random-default' => false,
'width' => 320,
'height' => 60,
'flex-height' => true,
'flex-width' => true,
'default-text-color' => '#333333',