Skip to content

Instantly share code, notes, and snippets.

View kristarella's full-sized avatar

Kristen Symonds kristarella

View GitHub Profile
@kristarella
kristarella / nav_menu.css
Created January 19, 2014 08:08
Mobile menu for Genesis
@media only screen and (max-width: 664px) {
.mobile_menu {
display: block;
width: 90%;
margin-left: auto;
margin-right: auto;
padding: 5px 20px;
padding: 0.5rem 2rem;
cursor: pointer;
@kristarella
kristarella / genesis_backtotop.php
Created January 16, 2014 22:47
Back to top link that works in Genesis HTML5 framework
<?php
// custom header ID for backtotop
add_filter('genesis_attr_site-header','mytheme_header_id',1);
function mytheme_header_id($atts) {
$atts['id'] = "header";
return $atts;
}
// back to top link
@kristarella
kristarella / genesis_grid_loop.php
Last active January 3, 2016 12:49
Grid loop for homepage (with HTML 5 removal of post footer).
<?php
//* Remove the post meta function for front page only
remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
//* Add support for Genesis Grid Loop
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'child_grid_loop_helper' );
function child_grid_loop_helper() {
if ( function_exists( 'genesis_grid_loop' ) ) {
@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',
@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 / 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 / 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 / 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 / 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 / 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]