WordPress Move Domain Names

Switching domain names when using WordPress involves a few steps you may not think are required. Since WordPress saves the domain name permanently to the database, we have to modify the database along with a few configuration files to move WordPress to a different name. Below is a step by step guide to move your WordPress installation from your old domain name to your shiny new domain name. This tutorial requires a few key pieces of software.

PHP Calculate Time Since

While working on a few changes to this website, I needed to code or find a relative time function for PHP. A function that will turn a timestamp or unix_timestamp into how long ago it was performed. For instance, if the timestamp is from yesterday, it would return the string of “1 day ago”, up to values of years. But there was an issue. Whenever I went online to find a function to do this, they all had a ton of nested if statements and a huge list of cases also.

PHP Display Database Table

For administration panels or at times just data shown on the site, you will need to show a full database table. Now, you can manually enter the column’s rows names, but an easier way and more dynamic way is to just get the column names from MySQL or various other databases you use. In this tutorial, we will be using the PHP class PDO. PDO is more secure than the original mysql_ functions, and if you haven’t yet, you should make the change right away.

PHP Send HTML Email

With the PHP mail function you can send all sorts of emails, including HTML emails and emails that have various attachments. But you will have to generate the proper headers and change the message text. The way the mail function in PHP works, is sending “plain text” emails. HTML emails are plain text emails but with additional headers and the proper encoding set. Below I will show you how you can simply send your HTML emails using PHP without using huge libraries that a lot of people will suggest.

JavaScript Tag Cloud

In a previous tutorial we made a PHP Tag Cloud generator function. But, some people don’t have access to PHP or need the tag cloud to update live using ajax or other means. Below is the JavaScript function and code. The code is fairly similar to the PHP Code, but just modified slightly for use with JavaScript. You call the function by identifying the DOM which all the words are listed in, and you also have to specify the Node Name, such as span or div.