Skip to content

Instantly share code, notes, and snippets.

View jeffsebring's full-sized avatar

Jeff Sebring jeffsebring

  • Spokane, Washington USA
View GitHub Profile
public static function filters( $filter = null, $value = null )
{ global $Render;
$value = apply_filters( 'render_' . $filter, $value );
if ( ! empty( $Render->template[ 'view' ] ) )
$filters[] = $Render->template[ 'view' ];
if ( ! empty( $Render->template[ 'post_type' ] ) )
$filters[] = $Render->template[ 'post_type' ];
@jeffsebring
jeffsebring / mount_luks.sh
Created June 22, 2012 19:38
Mount Luks drive
mkdir /media/home
sudo cryptsetup luksOpen /dev/sda2 home
sudo mount /dev/mapper/home /media/home
@jeffsebring
jeffsebring / jeffsebring.com.nginx.conf
Created July 26, 2012 07:27
Example nginx config
server {
server_name www.jeffsebring.com;
rewrite ^/(.*)$ http://jeffsebring.com/$1 permanent;
}
server {
#port 8080;
server_name jeffsebring.com;
access_log /PATH/logs/access/jeffsebring.com_access.log;
error_log /PATH/logs/errors/jeffsebring.com_error.log;
@jeffsebring
jeffsebring / custom_post_type.php
Created October 18, 2012 22:29
Create Custom Post Type
<?php
add_action( 'init', function()
{
register_post_type( 'code',
array(
'labels' => array(
'name' => _x( 'Code', 'post type general name' ),
@jeffsebring
jeffsebring / enqueue_theme_js.php
Last active October 12, 2015 00:17
Hidden Gravity Forms Validation & Confirmation
# Use the wp_enqueue_scripts hook to enqueue scripts and styles
add_action( 'wp_enqueue_scripts', 'mytheme_enqueue', 99999);
# Callback function
function mytheme_enqueue()
{
wp_enqueue_script( 'mytheme', get_stylesheet_directory_uri() . '/javascripts/theme.js', array( 'jquery' ), '', 'footer' );
}
@jeffsebring
jeffsebring / _wordpress.sass
Created October 29, 2012 16:21
WordPress Core Styles SASS
.sticky,
.bypostauthor,
.gallery-caption
display: normal
.alignright
float: right
display: block
.alignleft
@jeffsebring
jeffsebring / etc-fonts-local.conf
Created November 14, 2012 06:06
Arch Linux Font Config
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="font" >
<edit mode="assign" name="autohint"> <bool>true</bool></edit>
<edit mode="assign" name="hinting"> <bool>false</bool></edit>
<edit mode="assign" name="lcdfilter"> <const>lcddefault</const></edit>
<edit mode="assign" name="hintstyle"> <const>hintslight</const></edit>
<edit mode="assign" name="antialias"> <bool>true</bool></edit>
<edit mode="assign" name="rgba"> <const>rgb</const></edit>
@jeffsebring
jeffsebring / hide_dashboard_jazz.php
Created November 17, 2012 07:32
Hide Dashboard Jazz
function js_remove_dashboard_widgets() {
remove_meta_box( 'dashboard_quick_press', 'dashboard', 'side' );
remove_meta_box( 'dashboard_recent_drafts', 'dashboard', 'side' );
remove_meta_box( 'dashboard_primary', 'dashboard', 'side' );
remove_meta_box( 'dashboard_secondary', 'dashboard', 'side' );
remove_meta_box( 'dashboard_plugins', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_incoming_links', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_recent_comments', 'dashboard', 'normal' );
remove_meta_box( 'dashboard_incoming_links', 'dashboard', 'normal' );
@jeffsebring
jeffsebring / newp.sh
Created November 21, 2012 21:06
New WordPress Install with separated directories
#!/bin/sh
wget http://wordpress.org/latest.tar.gz
tar -zxvf latest.tar.gz
rm latest.tar.gz
mv wordpress __
mv __/wp-content _
echo "<?php" >> index.php
echo "define( 'WP_USE_THEMES', true );" >> index.php
echo "require('./__/wp-blog-header.php');" >> index.php
@jeffsebring
jeffsebring / js_metabox_example.php
Last active December 16, 2015 06:49
Simple Metabox Example w/ 20 Character Validation Error
<?php
/**
* Simple Metabox Example
*
* Validates string is under 20 characters
*
* Copyright (C) 2013 Jeff Sebring <http://jeffsebring.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by