If you have an application or CMS running, you might have SEO url’s enabled through .htaccess rewrites. Now installing a second application in a subfolder on the same domain can cause 404 errors. This is because all subfolders follow the rules specified in the root htaccess file. To prevent the errors, […]
Snippets
With the background-size property in CSS3, we can get a full page scaleable background image. Here’s the CSS code: html { background: url(images/background.jpg) no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } Background image is centered, automatically resized according to browser size, and retains the aspect […]
Here are three SQL queries to find and safely delete all unused tags from your WordPress blog database. The below command will show you all the unused tags in the database. SELECT * FROM wp_terms wterms INNER JOIN wp_term_taxonomy wttax ON wterms.term_id = wttax.term_id WHERE wttax.taxonomy = ‘post_tag’ AND wttax.count […]
Here’s a snippet to display a simple maintenance mode message to all non-admin visitors of your WordPress blog, while you carry on your tasks in the back-end. function wp_maintenance_mode() { if ( !is_user_logged_in() || !current_user_can( ‘manage_options’ ) ) { wp_die(‘Site is undergoing maintenance at the moment, please come back after […]
Allows a user to toggle password to text to see what they typed in a field in a form or any text input field.
This little jQuery snippet adds a smooth scroll-to-top effect on a page. Unlike some other methods, this doesn’t need an anchor for the scroll effect to work on a page. You can change the scroll speed and “scroll up to” position in this script. $(document).ready(function(){ $(“.top”).click(function(e){ e.preventDefault(); $(“body,html”).animate({ scrollTop: 0 // Top […]
Run the following two SQL commands from PHPMyAdmin to clean up the wp_commentmeta table in your WordPress installation.
This little snippet lets you create a new user in WordPress, with the role you want, using just the theme’s functions.php file.