Skip to content

Instantly share code, notes, and snippets.

// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@RonnyO
RonnyO / jquery.qDefer.min.js
Created April 15, 2012 11:24
Simply mimic the 'defer' attribute for inline scripts across all browsers (jQuery helper)
// http://bit.ly/qDefer
$(function(){$('script[type="text/javascript/defer"]').each(function(){$(this).clone().attr('type','').insertAfter(this)})});
@franz-josef-kaiser
franz-josef-kaiser / admin_menu_separator.php
Last active September 7, 2020 22:05
WordPress (mu)plugin to add a separator to the admin menu with a call to the default API. Explanation can be found in the doc block. // Screenshots (main menu separator) http://i.stack.imgur.com/HUmKQ.png // (submenu separator) http://i.stack.imgur.com/6AKDY.png
<?php
defined( 'ABSPATH' ) OR exit;
/**
* Plugin Name: Admin Menu Separator
* Description: Adds a separator on whatver priority is needed.
*/
add_filter( 'parent_file', 'admin_menu_separator' );
function admin_menu_separator( $parent_file )
{
<?php
/*
Better browser detection
with language_attributes() filter in WordPress
http://simplemediacode.info/?p=1006
*/
add_filter('language_attributes','smc_language_attributes');
function smc_language_attributes($content){
global $is_IE;
$browser = $_SERVER['HTTP_USER_AGENT'];
@bhwebworks
bhwebworks / add to functions.php
Last active December 17, 2015 05:09
Filter the genesis_seo_site_title function to use an image for the logo instead of a background image
/**
* Filter the genesis_seo_site_title function to use an image for the logo instead of a background image
*
* The genesis_seo_site_title function is located in genesis/lib/structure/header.php
* @link http://blackhillswebworks.com/?p=4144
*
*/
add_filter( 'genesis_seo_title', 'bhww_filter_genesis_seo_site_title', 10, 2 );
# Requires: xcode, xcode command line tools
# Need to do:
# nginx.conf
# php-fpm plist
# Install homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
# Install requirements

Comment Blacklist for WordPress

Sometimes a simple solution is a better solution.

Over the past couple of years, I have identified over 5,600 phrases, patterns, and keywords commonly used by spammers and comment bots in usernames, email addresses, link text, and URIs. This blacklist is still a work in progress and there is certainly room for optimization. Suggestions are always appreciated.

How Do I Use It?

Copy the list of keywords, paste it into the Comment Blacklist field of your WordPress Discussion Settings panel, and click the “Save Changes” button.

@bryanwillis
bryanwillis / styletheadmin.css
Created December 9, 2013 19:47
styletheadmin function customAdmin() { ?><link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_directory'); ?>/wp-admin.css" /><?php } add_action('admin_head', 'customAdmin');
body {color:white;}
@georgiecel
georgiecel / wp-comment-walker
Last active December 28, 2022 15:16
Custom comment walker for HTML5 friendly WordPress comment and threaded replies. To be inserted in functions.php.
<?php
class comment_walker extends Walker_Comment {
var $tree_type = 'comment';
var $db_fields = array( 'parent' => 'comment_parent', 'id' => 'comment_ID' );
// constructor – wrapper for the comments list
function __construct() { ?>
<section class="comments-list">
@bryanwillis
bryanwillis / alternative_variable_defining_methods.php
Last active March 8, 2016 09:52
Awesome function I came across awhile back to fix issues in php when debugging is giving you undefined variables. Whatever is undefined just replace with exst(). For example if variable $xyz is undefined replace it with exst($xyz) and it will not longer return errors. While it's better to write your code in a way to avoid this, it's an easy way …
<?php
// recommended solution
$user_name = $_SESSION['user_name'];
if (empty($user_name)) $user_name = '';
// OR
// just define at the top of the script index.php
$user_name = '';