When I first dove into WordPress, I was so impressed with the power of plugins! You could do almost anything with a plugin, right?
It didn’t take long and I wanted to reduce the number of plugins, and stop faking my way through WordPress and start coding it myself. There are so many things you can do without plugins, plus, you want to make sure your WordPress site isn’t plagued with plugin bloat and have to deal with epidemic updates.
Here are three quick WordPress hacks that I’ve found to be very useful, and a fourth hack that’s just plain fun:
1. Simple Login
I now use this for every one of my clients. It makes logging in so much easier. I know that remembering wp-login.php isn’t that hard, but it makes it so much easier. This is also nice for Church websites that have multiple contributors. It makes everything nice and clean.
Here’s how to do it.
Example: http://website.com/login
Back-up your .htaccess file (located at the root of your WordPress install).
Add the following:
[cc lang=”php”]RewriteRule ^login$ http://website.com/wp-login.php [NC,L][/cc]
It’s that easy!
Of course, it doesn’t have to be login, either.
2. Disable Theme Switching
Some clients want to make sure they have Admin rights. Maybe it’s a power thing? I don’t know.
This can also a great way to protect a site, especially if you rely heavily on the theme (custom functions, etc …).
Here’s a great way to ensure the theme doesn’t get switched up!
Drop this code in your functions.php:
[cc lang=”php”]add_action(‘admin_init’, ‘cwc_lock_theme’);
function cwc_lock_theme() {
global $submenu, $userdata;
get_currentuserinfo();
if ($userdata->ID != 1) {
unset($submenu[‘themes.php’][5]);
unset($submenu[‘themes.php’][15]);
}
}[/cc]
Simple and easy.
3. Maintenance Mode Made Easy
There are plenty of plugins that take care of this, in fact, some include a countdown, etc … However, sometimes you just need to put your site on pause and bang-out a quick tweak or two.
Add this (or add it now, and un-comment when you need it) to your functions.php:
[cc lang=”php”]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’);[/cc]
Finished? Be sure to put it back to normal, since the WordPress site is completely available to those logged-in as Admin!
4. Change WordPress Editor Font
This is fun and fairly useless.
Change the default font used in the WordPress visual editor.
Add this to to your functions.php and be sure to define your font:
[cc lang=”php”]add_action( ‘admin_head-post.php’, ‘cwc_fix_html_editor_font’ );
add_action( ‘admin_head-post-new.php’, ‘cwc_fix_html_editor_font’ );
function cwc_fix_html_editor_font() { ?>
Do you have any quick WordPress hacks? Let us know!
Jonathan Blundell says
The 1st hack is nice. I’ve always just pointed people to http://blogurl.com/wp-admin
No one’s complained yet about it being hard to remember… but maybe they’re keeping it to themselves 😉
Eric Dye says
Maybe, so!
Jerry McNamara says
I appreciate these. You guys that know code are like the wizards of today. Just as cars used to be simple to work on (but now require too much equipment and technical know-how), I thought switching to WP for web would make my and my church/clients happier. Instead, I keep seeing stuff and go “Oooh! I want to make my site(s) do that!” Is it just the tantalizing tech sirens’ call for More!” I wonder some times. Example: I desperately want to have a have a page on my site that displays all my ministry area pages (youth, children’s women, etc.) with the page name, thumb, and description. There are plugins and themes that allow that to happen in widgeted areas and sidebars, but I have yet to find an easy cut-and-paste code for a whole page (that works for current version of WP). Got any perspective on the temptation for more? Or got the code to make my wish come true, oh web wizard? God bless you in your tent making ministry. When I come to Italy (2012 or 2013) I hope I can take you out for dinner and some vino for all I’ve learned from your site! CIAO!
Eric Dye says
Just one page to list all the ministries?
Jerry McNamara says
Yeah, for a start…not all of your followers are mega church dude-bros! 🙂
Eric Dye says
I know, right!
Why don’t you list them, just as you described, with a static WordPress page?
BJ McGeever says
Love the maintenance function. So brilliant.
Eric Dye says
Right! I’m thinking about building it as a mini plugin, so I can just enable it whenever I need it!
Marlin Caddell says
That first option is really nice for redirecting people. For several of my clients, I have done a meta redirect to get them to the login page. I created the page with the address I wanted, and set up a meta redirect on the page to push people to http://URL/wp-admin.
Eric Dye says
Great solution.