Skip to content

Instantly share code, notes, and snippets.

@robneu
robneu / wordpress-browser-cache-htaccess
Created February 3, 2014 05:39
.htaccess rules for WordPress browser caching.
# BEGIN Browser Cache
<IfModule mod_deflate.c>
<IfModule mod_setenvif.c>
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
</IfModule>
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE text/css application/x-javascript text/x-component text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon
@robneu
robneu / cpanel-nginx.conf
Created March 17, 2014 05:32
Cpanel Nginx Conf. Use at your own risk.
user nobody;
# you must set worker processes based on your CPU cores, nginx does not benefit from setting more than that
worker_processes 2;
# number of file descriptors used for nginx
# the limit for the maximum FDs on the server is usually set by the OS.
# if you don't set FD's then OS settings will be used which is by default 2000
worker_rlimit_nofile 100000;
<?php
add_filter( 'genesis_seo_title', 'prefix_seo_title_fix' );
/**
* Correct a bug in Genesis that causes the home page title to display with a p
* tag instead of a h1 tag when a static front page is in use.
*
* @copyright Copyright (c) 2014, FAT Media, LLC
*/
function prefix_seo_title_fix( $title, $inside, $wrap ) {
@robneu
robneu / gist:10618609
Last active August 29, 2015 13:59 — forked from srikat/gist:10617747
<?php
printf( '<div %s>', genesis_attr( 'site-tagline-left' ) );
printf( '<p %s>%s</p>', genesis_attr( 'site-description' ), esc_html( get_bloginfo( 'description' ) ) );
echo '</div>';
@robneu
robneu / gregs-threaded-comment-numbering-gnesis.css
Last active August 29, 2015 14:00
How to add comment numbering to a WordPress theme using Greg's Threaded Comment Numbering plugin. Includes support for Genesis.
/* Greg's Threaded Comment Numbering Genesis
--------------------------------------------- */
.commentnumber {
display: block;
float: right;
font-size: 40px;
font-size: 4rem;
margin-left: 20px;
margin-left: 2rem;
padding: 0 20px;
<?php
/**
* Add custom icons using Dashicons for Gravity Forms.
*
* This outputs some extra stlying to force Gravity Forms to use a modern
* dashicon in the wp-admin sidebar.
*
* @author Robert Neu
* @link http://melchoyce.github.io/dashicons/
@robneu
robneu / check-custom-post-type.php
Last active August 29, 2015 14:00
Check if the current post is a particular post type.
<?php
/**
* Check the current post to see what type of post it is.
*
* This will return true whenever a post is equal to a specified post type.
* It can be useful when making global changes for a particular post type.
*
* @param $post_types array or string the type of posts you're wanting to check.
* @return bool true if the current post type matches any of the checked types.
@robneu
robneu / check-array-for-values.php
Last active August 29, 2015 14:00
Check an array to see if any of the values aren't empty. Also includes some example usage functions and an example template to show how the function could be used to display some Advanced Custom Fields data.
<?php
/**
* Check an array to see if any values aren't empty.
*
* @param $array the array of data that you want to check for filled values.
* @return bool true if the array has at least one non-empty value.
* @author Robert Neu <http://wpbacon.com>
*/
function prefix_array_has_data( $array ) {
### Keybase proof
I hereby claim:
* I am wpbacon on github.
* I am robertneu (https://keybase.io/robertneu) on keybase.
* I have a public key whose fingerprint is C486 BFE2 48DE 6FA6 7CAD CEC5 D506 FDC5 70D2 A57D
To claim this, I am signing this object:
@robneu
robneu / disqus-broken.php
Last active August 29, 2015 14:00
As of version 2.74, the Disqus plugin has a bug that produces warrning notices when trying to connect to the WordPress database. This should fix the issue.
<?php
// Ignore the <?php tag, it's only here for syntax highlighting.
// This can be found on line 285 of disqus.php
$commentdata = $wpdb->get_row($wpdb->prepare( "SELECT comment_ID, comment_parent FROM $wpdb->comments WHERE comment_agent = 'Disqus/1.0:{$comment->id}' LIMIT 1"), ARRAY_A);