Skip to content

Instantly share code, notes, and snippets.

@unix7
unix7 / gist:1824802
Created February 14, 2012 08:28
Genesis - Add Print Stylesheet
/** Add print stylesheet */
add_action( 'wp_print_styles', 'autobahn_add_print_stylesheet' );
function autobahn_add_print_stylesheet() {
wp_enqueue_style( 'autobahn_print', get_stylesheet_directory_uri() . '/print.css', array(), CHILD_THEME_VERSION, 'print' );
}
@unix7
unix7 / gist:1824776
Created February 14, 2012 08:16
Genesis - Custom Header #1
/* functions.php */
/** Add support for custom header */
add_theme_support( 'genesis-custom-header', array( 'width' => 470, 'height' => 100, 'textcolor' => '444', 'admin_header_callback' => 'minimum_admin_style' ) );
/**
* Register a custom admin callback to display the custom header preview with the
* same style as is shown on the front end.
*
@unix7
unix7 / gist:1824770
Created February 14, 2012 08:14
Genesis - Custom Header #2
/* functions.php */
require_once(CHILD_DIR.'/lib/custom-header.php');
/* Create custom-header.php file */
<?php
if(genesis_get_option('header_custom') == 1) {
define('HEADER_TEXTCOLOR', '');
@unix7
unix7 / gist:1824761
Created February 14, 2012 08:10
Genesis - Theme Activation Welcome Message
/** Autobahn theme activation welcome message */
add_action( 'admin_notices', 'autobahn_child_theme_welcome', 11 );
function autobahn_child_theme_welcome() {
global $pagenow;
if ( is_admin() && isset($_GET['activated'] ) && $pagenow == "themes.php" ) {
$settings = sprintf( __( '<strong>Congratulations!</strong> You have successfully activated the <em>Autobahn</em> Child theme for Genesis. You should get started by configuring your settings via the regular <a href="%s" title="Genesis Framework Settings">Genesis Framework Settings page</a>. — Thank you for using this theme! I wish you a good -online- journey! <em>—David Decker, Autobahn theme developer :)</em>', 'autobahn' ) , admin_url( 'admin.php?page=genesis' ) );
$output = printf( '<div class="updated"><p>%1$s</p></div>', $settings );
}
}
@unix7
unix7 / .htaccess - Prevent Bot Attack
Created February 9, 2012 09:30
.htaccess - Prevent Bot Attack
# Bot Blocker
<IfModule mod_setenvif.c>
SetEnvIfNoCase User-Agent ^$ keep_out
SetEnvIfNoCase User-Agent (pycurl|casper|cmsworldmap|diavol|dotbot) keep_out
SetEnvIfNoCase User-Agent (flicky|ia_archiver|jakarta|kmccrew) keep_out
SetEnvIfNoCase User-Agent (purebot|comodo|feedfinder|planetwork) keep_out
<Limit GET POST PUT>
Order Allow,Deny
Allow from all
Deny from env=keep_out
@unix7
unix7 / .htaccess - Prevent Script Injection
Created February 3, 2012 23:50
.htaccess - Prevent Script Injection
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule ^(.*)$ index.php [F,L]
//Source: http://wp.smashingmagazine.com/2010/07/01/10-useful-wordpress-security-tweaks/