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 … 

 

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 … 

 

Syntaxhighlighter Evolved: change scripts to CDN

I try to maximise my efforts when it comes to page load times. As such, I’m a big fan and user of CloudFlare because it greatly reduced the loading times of my webpages. For the Syntaxhighlighter Evolved WordPress plug-in, I wanted to switch the scripts needed to CDNJS, the CloudFlare CDN for scripts and other static … 

 

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

 

Update DirectAdmin to PHP 7.0 (CustomBuild)

The web is about to get a whole lot faster! Just this week, HTTP version 2 was released, promising faster page load times. Now it’s PHP which is getting a huge upgrade, which comes with a bunch of new features and improvements. If your server runs DirectAdmin and you are looking to upgrade your PHP … 

 

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, … 

 

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 … 

 

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 … 

 

Google Search Console – “Missing: Updated” WordPress fix

In Google Search Console under Search Appearance > Structured Data, I found many errors for my WordPress website. The errors were all the same, Missing: Updated. This means that for each WordPress blogpost or article, that page did not have the updated microdata. So to resolve this error message, I had to add the missing updated field … 

 

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 … 

 

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 … 

 

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 … 

 

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 … 

 

WordPress text widget missing after site move

I moved a WordPress database over to a new home and apparently, all of my text widgets where missing. This might also happen when you try to edit your WordPress database in PHPMyAdmin (for example, you tried to manually edit a text widget in your database instead of the UI). To fix this, go to … 

 

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 …