Entries from 2012

Choosing the Date Format in WordPress Themes: Let’s Give Control Back to the User

So many WordPress themes have the date format hard coded into the theme files. The problem is that some users will prefer to display the date in another way. Maybe the chosen format doesn't match their organization's style guidelines or maybe the format isn't grammatically correct. Changing a hard-coded date requires users to dig through file after file to modify every instance. Plus, if the theme developer releases an update, the user may need to do it all over again. To save users the hassle, why not let them decide how the dates are displayed. There is a setting in WordPress after all. [Continue reading]

Do Single-Quoted Strings Cause More Harm Than Good in PHP?

When writing PHP code, is it better to use single or double quotes? Using single quotes wherever possible will improve the performance of your code, but does it cost too much in productivity when less experienced developers work with the code? After all, certain things won't work as some might expect when using single quotes, such as variables inside the string. [Continue reading]

Using PHP’s implode() Function to Display an Array as a Value-Separated String

When displaying the contents of an array in PHP, what is your go to method? For example, if the items need to be displayed as a comma-separated or HTML unordered list, would you use a foreach() or for() loop? Utilizing a loop would accomplish the task. But there are other options. Why not give the implode() function a shot. [Continue reading]