Skip to content

Instantly share code, notes, and snippets.

@graphikuz
graphikuz / gist:3170cbae44f1740aaaf9
Created August 8, 2014 10:11
Wordpress: Only show admin bar to administrator
/**
* Only show admin bar to administrator
*
* Add to functions.php
*/
if (!current_user_can('administrator')) :
show_admin_bar(false);
endif;
@graphikuz
graphikuz / gist:c631f5c8379cf8cd902f
Created August 8, 2014 10:08
htaccess: Reduce HTTP response time with Gzip
# .htaccess Gzip Compression
# Gzip reduces HTTP response time
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
</ifmodule>
@graphikuz
graphikuz / gist:3753a95be4d5d1868f36
Created August 8, 2014 10:06
Wordpress: Force direct update of WP
/**
* Force direct update of WP
*
* Add to wp-config.php
*/
define('FS_METHOD','direct');
@graphikuz
graphikuz / gist:62a4a3d4d5ae0bea4b0e
Created August 8, 2014 10:03
Wordpress: Remove WP logo from admin bar
/**
* Remove WP Logo from admin bar
*/
function wplogo_admin_bar_remove() {
global $wp_admin_bar;
$wp_admin_bar->remove_menu('wp-logo');
}
@graphikuz
graphikuz / gist:6f67fd75bff4668eb4c2
Created August 8, 2014 10:01
Wordpress: Protect wp-config.php with .htaccess
# Protect wp-config.php
<files wp-config.php>
order allow,deny
deny from all
</files>
@graphikuz
graphikuz / gist:f67f23cbecc9d55a94a0
Created August 7, 2014 21:11
Wordpress: Define maximum file upload limit
/**
* Define maximum file upload limit
*/
define('WP_MEMORY_LIMIT', '64M');
@graphikuz
graphikuz / gist:c92b0fa960b5151f7fd2
Created August 5, 2014 12:50
CSS: Vertical Align Element
/* vertical-align */
position: relative;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
@graphikuz
graphikuz / gist:04f4ed1ff012c11189b2
Created August 5, 2014 07:33
Wordpress: Get first parent
//Get first parent
$parent = array_reverse(get_post_ancestors($post->ID));
$first_parent = get_page($parent[0]);
echo $first_parent->post_name;
@graphikuz
graphikuz / gist:b775ddd1c98b7be4c991
Created August 4, 2014 15:39
CSS: Animate Ellipsis
@-webkit-keyframes opacity {
0% { opacity: 1; }
100% { opacity: 0; }
}
@-moz-keyframes opacity {
0% { opacity: 1; }
100% { opacity: 0; }
}
@graphikuz
graphikuz / gist:28dbab656ad386d35476
Last active August 29, 2015 14:04
htaccess: Font MIME types
# Font mime types
#AddType application/vnd.ms-fontobject .eot
#AddType application/x-font-ttf .ttf
#AddType application/x-font-woff .woff
AddType font/ttf .ttf
AddType font/eot .eot
AddType font/otf .otf
AddType font/opentype .woff