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 / .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/
@unix7
unix7 / gist:4510595
Last active March 21, 2018 14:57
Basic CSS For Formidable Form
/* Form */
.with_frm_style label{
font-size:12px;
float:none;
text-align:left;
margin:0;
padding:0;
width:auto;
}
@unix7
unix7 / style.css
Last active December 16, 2015 07:49
Example for hyperlink in sidebar for kujie2.com
#sidebar a {
color: #333;
}
#sidebar a:hover {
color: #d458a6
}
@unix7
unix7 / gist:4573422
Created January 19, 2013 16:17
URL Changes for Kujie2.com after deactivating the WP-HTML-Compression plugin
/*
* URL Changes for Kujie2.com after deactivating the WP-HTML-Compression plugin
*/
/** Before - Plugin: Activate */
<link rel="alternate" type="application/rss+xml" title="Hidup Biar Sedap &raquo; Feed" href="feed"/>
/** After - Plugin: Deactivate */
@unix7
unix7 / gist:4562258
Last active December 11, 2015 06:49
Feed Urls Comparison
/*
* Kujie2.com
* Result: Error
*/
<link rel="alternate" type="application/rss+xml" title="Hidup Biar Sedap &raquo; Feed" href="feed"/>
/*
* Puanbee.com
* Result: OK
@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(
@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: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: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
*/