Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / Responsive Image CSS
Created February 23, 2012 18:31
Responsive Image
//Source: http://jeffsebring.com/responsive-wordpress-images/
.entry-content img, .comment-content img, .widget img {
max-width: 97.5%;
}
img[class*="align"], img[class*="wp-image-"] {
height: auto;
}
@unix7
unix7 / 3-columns-home.php
Last active October 7, 2015 13:37
3 column homepage
<?php
/*
Template: Home
*/
//Add Post Class Filter
add_filter('post_class', 'sf_post_class');
function sf_post_class($classes) {
global $loop_counter;
$classes[] = 'one-third';
@unix7
unix7 / gist:3260560
Created August 4, 2012 23:23
Shadow on Top of Image
/**
* Shadow on Top of Image
* @author: Affan Ruslan
* @link: Affanruslan.com
* Use shadow box for the primary (top) menu.
* Use inset shadow for the secondary (bottom) menu.
* Preview http://imgur.com/QTKNO
*/
@unix7
unix7 / gist:3707162
Created September 12, 2012 14:53
Exclude Certain Post Format from Blog Loop
//Source: http://www.billerickson.net/customize-the-wordpress-query/#example-category
<?php
/**
* Exclude Post Formats from Blog
*
* @author Bill Erickson
* @link http://www.billerickson.net/customize-the-wordpress-query/
* @param object $query data
*
@unix7
unix7 / gist:3707171
Created September 12, 2012 14:54
Add CPT to Feed
// Source: http://yoast.com/custom-post-type-snippets/
// Add a Custom Post Type to a feed
function add_cpt_to_feed( $qv ) {
if ( isset($qv['feed']) && !isset($qv['post_type']) )
$qv['post_type'] = array('post', '<CPT>');
return $qv;
}
add_filter( 'request', 'add_cpt_to_feed' );
@unix7
unix7 / gist:3886987
Created October 14, 2012 01:57
Advance Customization of Genesis Comment
// Source: http://genesissnippets.com/custom-comments-html-output-with-genesis-framework/
// First remove the genesis_default_list_comments function
remove_action( 'genesis_list_comments', 'genesis_default_list_comments' );
// Now add our own and specify our custom callback
add_action( 'genesis_list_comments', 'child_default_list_comments' );
function child_default_list_comments() {
$args = array(