Skip to content

Instantly share code, notes, and snippets.

View derekshirk's full-sized avatar
🚙
Principal Product Designer at Driveway

Derek Shirk derekshirk

🚙
Principal Product Designer at Driveway
View GitHub Profile
@derekshirk
derekshirk / wordpress-email-cloaking.php
Last active August 29, 2015 14:03
WordPress - email cloaking function
<?php
$my_email_address = "my.secret.email.address@gmail.com";
$my_email_address_cloaked = antispambot( $my_email_address );
echo $my_email_address_cloaked;
?>
// you can cloak email addresses anywhere in your posts wit this shortcode
<?php
function antispambot_sc( $atts ) {
@derekshirk
derekshirk / gist:25450da592aafde62f71
Last active August 29, 2015 14:03
WordPress - Split content Before & After The More Tag
<?php
while( have_posts() ) : the_post();
$content_parts = get_extended( get_the_content() );
echo '<h1 class="post-title">' . get_the_title() . '</h1>';
echo '<p class="intro">' . $content_parts['main'] . '</p>';
echo '<!-- Paste your ad code here. -->';
echo '<div class="article">' . $content_parts['extended'] . '</div>';
@derekshirk
derekshirk / gist:bc676706d332573fcb51
Created June 27, 2014 16:41
WordPress - Enqueueing Inline CSS
<?php
$custom_style_file = get_template_directory_uri() . '/css/custom_style.css';
function custom_styles() {
wp_enqueue_style( 'custom-style', $custom_style_file );
$headline_font_weight = get_theme_mod( 'headline-font-weight' );
$custom_style = '.headline { font-weight: ' . $headline_font_weight . '; }';
wp_add_inline_style( 'custom-inline-style', $custom_style );
}
add_action( 'wp_enqueue_scripts', 'custom_styles' );
@derekshirk
derekshirk / gist:738722eb02a917764eac
Created July 9, 2014 21:01
MySQL - Adding users
INSERT INTO `local_bellevue`.`wp_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_activation_key`, `user_status`, `display_name`) VALUES ('4', 'derek', MD5('HoodRiver072812'), 'Derek Shirk', 'derek@brewhousepdx.com', 'http://www.brewhousepdx.com/', '2011-06-07 04:04:04', '', '0', 'Derek Shirk');
INSERT INTO `local_bellevue`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '4', 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');
INSERT INTO `local_bellevue`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '4', 'wp_user_level', '10');
@derekshirk
derekshirk / wp-remove-feed-links.php
Last active May 15, 2017 08:17
WordPress - Remove Feed Links
@derekshirk
derekshirk / wp-remove-migrate.js
Last active August 29, 2015 14:03
Wordpress - Remove jquery migrate js
// -----------------------------------------------------------------------------------------
// Remove jquery migrate js
// -----------------------------------------------------------------------------------------
function dequeue_jquery_migrate( &$scripts){
if(!is_admin()){
$scripts->remove( 'jquery');
$scripts->add( 'jquery', false, array( 'jquery-core' ), '1.10.2' );
}
}
@derekshirk
derekshirk / headings.css
Created December 20, 2014 07:44
CSS - perfect fourth styles from type-styles.com
/*----------------------------------------------------------------
Perfect Fourth (http://type-scale.com)
----------------------------------------------------------------*/
h1 {
font-size: 2.369em;
}
h2 {
font-size: 1.777em;
@derekshirk
derekshirk / sass-link-mixin.scss
Last active August 29, 2015 14:13
sass - simple link mixin
@derekshirk
derekshirk / sass-box-mixin.scss
Last active August 29, 2015 14:13
sass - simple box mixin
$box-style1: 5px, solid, red;
$box-style2: (bStyle: dotted, bColor: blue, bWidth: medium);
@mixin boxy($bWidth, $bStyle, $bColor) {
border-width: $bWidth;
border-style: $bStyle;
border-color: $bColor;
}
.first {
@derekshirk
derekshirk / inline-style-generator.php
Last active August 29, 2015 14:15
Theme Style Approach
<?php
global $post,$wp_query;
get_header();
?>
<!-- Blog Header -->
<div class="blog-header-wrapper">
<?php
$color = oneengine_option('header_blog_color');
$img = oneengine_option('header_blog_img', false, 'url');
$repeat = oneengine_option('header_blog_repeat');