Skip to content

Instantly share code, notes, and snippets.

View ataylorme's full-sized avatar

Andrew Taylor ataylorme

View GitHub Profile
@ataylorme
ataylorme / SassMeister-input.scss
Created November 25, 2014 21:00
Generated by SassMeister.com.
// ----
// libsass (v3.0.1)
// ----
h1{
font-size: 48px;
@media only screen and (max-width: 768px){
font-size: 32px;
}
@media only screen and (max-width: 480px){
add_theme_support( 'typecase', array(
// array of simple options
'simple' => array(
// each array is an option
// these options are displayed in the main theme fonts panel section
array(
// the label displayed in customizer
'label' => 'Body Copy',
// the CSS selector to apply the font to
'selector' => 'body',
@ataylorme
ataylorme / SassMeister-input.scss
Created January 14, 2015 22:15
Generated by SassMeister.com.
// ----
// libsass (v3.1.0-beta)
// ----
//BREAKPOINTS
$Mobile: 480px;
$Landscape: 801px;
$Desktop: 1400px;
//MEDIA QUERY MIXIN
@ataylorme
ataylorme / php-divisible-by
Created November 15, 2012 08:07
Php divisible by
if(($count % $number) == 0){
//do something
}
@ataylorme
ataylorme / add-page-post-id-to-backend
Created November 15, 2012 08:24
Add page/post ID to backend
<?php
function posts_columns_id($defaults){
$defaults['wps_post_id'] = __('ID');
return $defaults;
}// end posts_columns_id function
function posts_custom_id_columns($column_name, $id){
if($column_name === 'wps_post_id'){
echo $id;
}
}// end posts_custom_id_columns function
@ataylorme
ataylorme / get-taxonomy-of-current-archive-page
Created November 17, 2012 22:48
Get taxonomy of current archive page
<?php $currentTax = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); ?>
@ataylorme
ataylorme / add-nofollow-comment-link
Created November 17, 2012 22:26
Add rel="nofollow" to comment reply links
@ataylorme
ataylorme / add-rel-prettyphoto-to-images-in-content
Created November 17, 2012 22:27
add rel="prettyPhoto" to images in the content
//start function to add rel attribute to image links
function rel_prettyPhoto($link) {
global $post;
$find ="/<a(.*?)href=('|")(.*?).(bmp|gif|jpeg|jpg|png)('|")(.*?)>/i";
$replace = '<a$1href=$2$3.$4$5 rel="prettyPhoto['. $post->ID .']" $6>';
$link = preg_replace($find, $replace, $link);
return $link;
} //end function to add rel attribute to image links
//add rel attribute function to the content filter
@ataylorme
ataylorme / add-sortable-custom-field-columns-to-wordpress-backend
Created November 17, 2012 22:30
Add sortable custom field columns to WordPress backend
// Register the column
function METAKEYHERE_column_register( $columns ) {
$columns['METAKEYHERE'] = __( 'COLUMNLABEL', 'POSTTYPE' );
return $columns;
}
add_filter( 'manage_edit-POSTTYPE_columns', 'METAKEYHERE_column_register' );
// Display the column content
function METAKEYHERE_column_display( $column_name, $post_id ) {
@ataylorme
ataylorme / change-custom-field-metakey-in-wordpress-database
Created November 17, 2012 22:34
Change custom field metakey in WordPress database
function ChangeMetaKey($old, $new){
global $wpdb;
$wpdb->query( "
update $wpdb->postmeta
set meta_key = '$new'
where meta_key = '$old'
");
}//end change metakey