In a previous tutorial we saw how you can recreate the All Posts table in the WordPress admin area by using the WP_List class in WordPress. It talks about creating your own table and populating it with any data that you need. It talks about how you can customise the table to behaviour in anyway that is needed by adding different columns to the table, assigning sortable columns to the
Here is a useful function I use in many of my applications, it will take a URL and see if it's prefixed with a protocol, if it's not then it will add the default prefix to the start of the string. This function will search for http://, https://, ftp:// and ftps://, if none of them are in the string then we add the prefix to the start of the string.
When you have built your site on an open source project like WordPress one of the benefits you get is continuous updates and improvements to the core code. WordPress aims to release a couple of versions per year, when there is a new version of WordPress available to download there will be a notification bar at the top of your admin area. This notification bar will let you know that
If you want to instantiate a class in PHP the class must be loaded into your application before you can use it. There are 4 ways you can load a class into your application include, include_once, require or require_once. But when you use this you must define all of the classes that you want to use in your application. Another option is to use an autoload function which will be
PHP has a few in-built magic method __get(), __set(), __sleep(), __toString() etc. These functions are all really useful but they are not used very often in your day-to-day development, but one magic method is really useful this is the __autoload() function. This function is automatically called each time you try to instantiate a class but the class can not be found. When you normally call a class to use in
Do you have a good way of organising and storing all your different code snippets? Because I use sublime text 3 as my code editor I used to just store all my code snippets as a snippet in sublime, this was fine if your are always working on one computer but what if you code on multiple computers? You won't be able to take all these code snippets with you.
Here is a technique about how you can absolute center position an element on the horizontal and vertical in CSS. Center Images Horizontally To center something on the horizontal in CSS it's quite easy all you need to do is set the width on the element and apply an auto margin-left and margin-right on to the image. The browser will work out the exact margin on both the right and
When you accept credit card numbers on your website you need to do a number of different validation checks on the credit card numbers the user enters. When the form is submitted you will need to check that the user has filled out the correct credit card number, expiry date and security code number. Before you send this to the bank or payment gateway for them to validate and process