The beauty of WordPress® is its flexibility. There are many simple ways to tweak your WordPress site to enhance your visitor’s experience. Here are just a few of Go Daddy Technologist +Gabe Williams' favorites:

Automatically Update Your Copyright Notice -

Add this code to your footer to automatically update the copyright each year.

/CODE/
Copyright &copy; <?php echo the_date('Y'); ?> Website Name

Redirect back To Referring Page After Login -

This simple snippet added to your functions.php file will redirect members back to the page they logged in from.

/CODE/
if ( (isset($_GET['action']) && $_GET['action'] != 'logout') || (isset($_POST['login_location']) && !empty($_POST['login_location'])) ) {
add_filter('login_redirect', 'my_login_redirect', 10, 3);
function my_login_redirect() {
$location = $_SERVER['HTTP_REFERER'];
wp_safe_redirect($location);
exit();
}
}

Change Admin logo -

To change the admin logo that is shown on the top left side of the page, add this to your functions.php template. This gives you an easy way to brand your WordPress site for registered users.

/CODE/
function custom_admin_logo() {
echo '<style type="text/css">
#header-logo { background-image: url('.get_bloginfo('template_directory').'/images/admin_logo.png) !important; }
</style>';
}
add_action('admin_head', 'custom_admin_logo');




SECURITY

Move Your wp-content Folder -

Almost all WordPress sites are set up the same. A great way to discourage hackers is to move your wp-content directory to a new location. Just specify where you moved your folder in your wp-config.php file.

/CODE/
// full local path of current directory (no trailing slash)
define('WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'].'/another-folder-or-location/wp-content');

// full URI of current directory (no trailing slash)
define('WP_CONTENT_URL', 'http://your-domain-name.com/another-folder-or-location/wp-content');

// full local path of current directory (no trailing slash)
define('WP_PLUGIN_DIR', $_SERVER['DOCUMENT_ROOT'].'/another-folder-or-location/wp-content/plugins');

// full URI of current directory (no trailing slash)
define('WP_PLUGIN_URL', 'http://your-domain-name.com/another-folder-or-location/wp-content/plugins');

Disable Directory Browsing -

Unless you specifically need it, always disable directory browsing on your site. Add this to your .htaccess and you will be set.

/CODE/
# disable directory browsing
Options All –Indexes

Use .htaccess To Blacklist Users And Bots -

If you are using any analytics program, you should be able to see if you are getting spammed by certain IPs. You can easily block them by adding this to your .htaccess.

/CODE/
<Limit GET POST PUT>
order allow, deny
allow from all
deny from 123.124.125.3
deny from 124.125.126.4
deny from 125.126.127.5
</Limit>


CSS

Center Your WordPress Website -

This little trick is extremely useful since you never know what resolution your viewer’s devices will be set at.

/CODE/
#wrapper{
width:960px;
margin:0 auto;
text-align:left;
}

CS Sticky Footer -

This is a super common request. Because often times your WordPress site and content is dynamic, you never know just how long the page will be. This code helps ensure your footer will display at the bottom of the page, just add to your stylesheet.

/CODE/
* {margin:0;padding:0;}

/* must declare 0 margins on everything, also for main layout components use padding, not
vertical margins (top and bottom) to add spacing, else those margins get added to total height
and your footer gets pushed down a bit more, creating vertical scroll bars in the browser */

html, body {height: 100%;}

#wrap {min-height: 100%;}

#main {overflow:auto;
padding-bottom: 150px;} /* must be same height as the footer */

#footer {position: relative;
margin-top: -150px; /* negative value of footer height */
height: 150px;
clear:both;}

/*Opera Fix*/
body:before {
content:"";
height:100%;
float:left;
width:0;
margin-top:-32767px;
}

This needs to be added to the head section of your page so that it displays correctly on Internet Explorer.

/CODE/
<!--[if !IE 7]>
<style type="text/css">
#wrap {display:table;height:100%}
</style>
<![endif]-->

*/

Add to HTML.

/CODE/
<div id="wrap">

<div id="main">

</div>

</div>

<div id="footer">

</div>

^+James Roberts
Shared publiclyView activity