Skip to content

Instantly share code, notes, and snippets.

@nyxsandbox
nyxsandbox / gist:3808716
Created September 30, 2012 23:21
Wordpress: Automatically Enable Threaded Comments
function enable_threaded_comments(){
if (!is_admin()) {
if (is_singular() AND comments_open() AND (get_option('thread_comments') == 1))
wp_enqueue_script('comment-reply');
}
}
add_action('get_header', 'enable_threaded_comments');
@nyxsandbox
nyxsandbox / gist:3808713
Created September 30, 2012 23:20
Wordpress: Dashboard Hacks - Login Custom Box Image
/* Login Box 310x70 */
function custom_login_logo() {
echo '<style type="text/css">
h1 a { background-image:url('.get_bloginfo('template_directory').'/img/login-logo.png) !important; }
</style>';
}
add_action('login_head', 'custom_login_logo');
@nyxsandbox
nyxsandbox / gist:3808710
Created September 30, 2012 23:19
Wordpress: Dashboard Hacks - Modify Footer Text
/* Footer */
function modify_footer_admin () {
echo 'Your Text Here';
}
add_filter('admin_footer_text', 'modify_footer_admin');
@nyxsandbox
nyxsandbox / gist:3808703
Created September 30, 2012 23:16
Wordpress: Dashboard Hacks - Disable the Admin Bar
// Disable the admin bar, set to true if you want it to be visible.
show_admin_bar(FALSE);
@nyxsandbox
nyxsandbox / gist:3808701
Created September 30, 2012 23:15
Wordpress: Dashboard Hacks - Remove Top Left Logo
/* Remove Top Left Logo Menu */
function annointed_admin_bar_remove() {
global $wp_admin_bar;
/* Remove their stuff */
$wp_admin_bar->remove_menu('wp-logo');
}
add_action('wp_before_admin_bar_render', 'annointed_admin_bar_remove', 0);
@nyxsandbox
nyxsandbox / gist:3808697
Created September 30, 2012 23:12
Wordpress: Quick Maintenance Mode
function cwc_maintenance_mode() {
if ( !current_user_can( 'edit_themes' ) || !is_user_logged_in() ) {
wp_die('Maintenance, please come back soon.');
}
}
add_action('get_header', 'cwc_maintenance_mode');
@nyxsandbox
nyxsandbox / gist:3808695
Created September 30, 2012 23:11
Wordpress: Automatically Replace Words in Posts
function replace_text_wps($text){
$replace = array(
// 'WORD TO REPLACE' => 'REPLACE WORD WITH THIS'
'wordpress' => '<a href="#">wordpress</a>',
'excerpt' => '<a href="#">excerpt</a>',
'function' => '<a href="#">function</a>'
);
$text = str_replace(array_keys($replace), $replace, $text);
return $text;
}
@nyxsandbox
nyxsandbox / gist:3808690
Created September 30, 2012 23:09
Wordpress: Add Extra Contact Methods to User Profiles
function my_user_contactmethods($user_contactmethods){
$user_contactmethods['twitter'] = 'Twitter Username';
$user_contactmethods['facebook'] = 'Facebook Username';
return $user_contactmethods;
}
add_filter('user_contactmethods', 'my_user_contactmethods');
@nyxsandbox
nyxsandbox / gist:3808664
Created September 30, 2012 22:56
Wordpress: .htaccess Firewall (v5)
# To install the 5G Firewall, append the following code to your site’s root .htaccess.
# 5G BLACKLIST/FIREWALL
# @ http://perishablepress.com/5g-blacklist/
# 5G:[QUERY STRINGS]
<ifModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} (environ|localhost|mosconfig|scanner) [NC,OR]
RewriteCond %{QUERY_STRING} (menu|mod|path|tag)\=\.?/? [NC,OR]
@nyxsandbox
nyxsandbox / gist:3808649
Created September 30, 2012 22:45
CSS: Natural Box Layout Model
/* apply a natural box layout model to all elements */
* { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; }