Skip to content

Instantly share code, notes, and snippets.

View michaeldozark's full-sized avatar

Michael Dozark michaeldozark

View GitHub Profile
@michaeldozark
michaeldozark / gforms-google-analytics.php
Last active August 29, 2015 14:01
Adds Google Analytics Tracking for Gravity Forms.
<?php
add_filter( "gform_submit_button", "slimline_gform_google_analytics", 10, 2 ); // add Google Analytics tracking to form submits
/**
* slimline_gform_google_analytics function
*
* Adds Google Analytics Tracking for Gravity Forms.
*
* @global object $wp The WordPress global object. Used for capturing the current request URI {@see http://kovshenin.com/2012/current-url-in-wordpress/}
@michaeldozark
michaeldozark / slimline-random-orderby.php
Last active August 29, 2015 13:57
Edit SQL ORDER BY statement to randomly order posts after other orders are accounted for.
<?php
/**
* slimline_random_orderby function
*
* Edit SQL ORDER BY statement to randomly order posts after other orders are accounted for.
*
* @param string $orderby The ORDER BY statement generated by get_posts()
* @return string $orderby ORDER BY statement with RAND() set as an additional clause
*/
@michaeldozark
michaeldozark / slimline-wp-list-pages.php
Last active August 29, 2015 13:56
Wrapper function for wp_list_pages() that accepts more than one ID in exclude_tree and adds an include_tree parameter
<?php
/**
* slimline_wp_list_pages function
*
* Builds include and exclude parameters from a tree before calling
* a standard wp_list_pages call. All parameters are the same as the
* wp_list_pages functions with one exception listed below.
*
* @param string $args[ 'include_tree' ] Define a comma-separated list of Parent IDs to be included
*/
AddType image/x-icon .ico
<IfModule mod_headers.c>
# YEAR
<FilesMatch "\.(ico|gif|jpg|jpeg|png|flv|pdf)$">
Header set Cache-Control "max-age=29030400"
</FilesMatch>
# WEEK
<FilesMatch "\.(js|css|swf)$">
Header set Cache-Control "max-age=604800"
</FilesMatch>
@michaeldozark
michaeldozark / cPanel Mime Types
Created January 24, 2014 17:21
Mime types list for cPanel GZIP compression
text/html text/plain text/xml text/css text/javascript application/javascript application/xhtml+xml application/xml application/rss+xml application/atom_xml application/x-javascript application/x-httpd-php application/x-httpd-fastphp application/x-httpd-eruby image/svg+xml
@michaeldozark
michaeldozark / wp-debug
Last active December 23, 2015 09:39
Better WordPress Debugging: Use WP_DEBUG flag, but only output errors to error log. Goes in wp-config.php. Thanks to ZippyKid for the idea.
define('WP_DEBUG', true); // false
if (WP_DEBUG) {
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
@ini_set('display_errors',0);
}