Detect iOS device (iPhone/iPad) in PHP

To detect if the device a user is using is an iOS device, you can use the following code snippet in PHP: This will check if in the user agent string the words ‘iPhone’ or ‘iPad’ occur. You can use this code snippet in your web development projects in order to detect whether your visitor is browser Continue reading →

 

Hide all WordPress update notifications in dashboard

WordPress has a build-in upgrade system. This system automatically informs you when there is an upgrade available for WordPress, or one of the themes or plugins that are installed on your WordPress installation. To disable this update notification, there is no switch in the settings menu or anywhere else in the admin dashboard. To prevent Continue reading →

 

WordPress: If homepage or index.php

To display content in WordPress only on the homepage (example.com) or on the index page (index.php), use the following code snippet: WordPress: If homepage or index.php was last modified: December 25th, 2015 by Thomas

 

Fix Image Upload “HTTP Error” on WordPress

When uploading an image on my WordPress blog, I received a general error that said HTTP error. As a result, the image upload failed. Luckily, I quickly found a fix. I recently upgraded my PHP version because of the speed improvement and the security patches. So I first tried looking for a permission mismatch somewhere, Continue reading →

 

Hide “Customize” menu option in WordPress

With the WordPress 4.3 release, the WordPress.org development team made some visual changes to this great CMS. One of them is the addition of a Customize option in the top admin bar, right next to your site’s name. Customize link added in the toolbar to swiftly make changes to your site. It’s great if you frequently make Continue reading →

 

Show current total of nline visitors with PHP

The following (free) PHP script shows the total number of unique visitors that are currently online on your website, based on their IP address. The first step is to create a file called visitors.db and to change its permissions to 666 via FTP (e.g. with the use of the FTP client FileZilla). This file will be Continue reading →

 

Add a canonical tag to WordPress header.php

Adding the canonical tag to your WordPress blog might be essential if you do not want search engines to see your content twice (= duplicate content) and thus giving you a penalty as such. To add this tag, simply go to your theme’s folder and find header.php. Now, add the following somewhere after <head> but Continue reading →

 

Output PHP errors on your pages

To output any PHP errors you might have, simply add the following at the top of your PHP file Or add the following to your php.ini file: This should display the errors. Make sure to restart your webserver; if you have Apache, use: Output PHP errors on your pages was last modified: November 27th, 2014 Continue reading →

 

Change default uploads folder in WordPress

To change the default folder where uploads are stored on your webserver when using WordPress as your CMS, open wp-config.php and add the following line of code: In this case, the folder where uploads are stored is called ‘uploads’ and can be found at example.org/uploads/ and are then, based on your settings, saved in a Continue reading →

 

Repair a broken WordPress database

If you WordPress blog MySQL database is broken, maybe as a result of manual tweaking, and you get errors, you can let WordPress fix your broken database all by itself. To do so, open wp-config.php and add the following line at the end of that file: This will ‘allow’ your WordPress installation to perform a Continue reading →

 

Add a custom logo to WordPress’ wp-admin login page

The default image you find when you go to example.org/wp-admin is the WordPress logo. To change this is an image of your choice, let’s say the logo of your company, simply add the following code to your functions.php file which can be found in the wp-content/themes/your-theme directory. Of course, make sure that the /wp-admin/images/wordpress-logo.png file Continue reading →