WordPress has a setting under the admin panel where blog owners can indicate how dates should be displayed for blog posts and comments made to the blog. The setting isn't very useful though when the date format is hard coded into the theme. Instead of making users edit the theme files, let's take advantage of the WordPress setting. Continue reading →
Using the Date Format Chosen by the User Instead of Hard-Coding Your Own in the WordPress Theme
January 23, 2012 — Tags: dates, WordPress
Choosing the Date Format in WordPress Themes: Let’s Give Control Back to the User
January 16, 2012 — Tags: dates, WordPress
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?
January 9, 2012 — Tags: coding practices, 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
January 2, 2012 — Tags: PHP
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 →
Managing Website Contact Information with E-mail Aliases
December 27, 2011 — Tags: e-mail
E-mail addresses change. Employees retire, switch jobs, etc. With that in mind, why would you list addresses that are tied to specific people on an organization's website? If your Contact Us page says "For questions or assistance, contact Bob@yahoo.com, Mary@gmail.com, or Scott@mywebsite.com". What happens if Bob quits? It may only take a few seconds to update the page, but things could be easier with e-mail aliases. Continue reading →
Easy Way for Comment Spam to Bypass the WordPress Moderation Queue
December 19, 2011 — Tags: spam, WordPress
Did you know that spammers could bypass the WordPress comment moderation feature? If your blog is set to automatically post comments from visitors who have previously approved comments, you could be at risk. However, there is a quick fix to the issue. Continue reading →
Slicing Strings with PHP: Be Mindful of Output that Contains HTML Tags
December 12, 2011 — Tags: HTML, PHP
When experimenting with strings which contain HTML code, be mindful of what you're getting for output. Especially if there is something unexpected about the results. That's what I learned the hard way when extracting an open anchor tag from the source code of a web page. The variables used to locate the anchor tag appeared to be working, but for some reason the extracted code wouldn't display to the screen. Let's take a look at where I went wrong. Continue reading →
Reducing the Number of Clicks When Saving Files Deep within a Website’s Structure by Using Shortcuts
December 5, 2011 — Tags: PDF, productivity
When receiving lots of files via e-mail to convert to PDF and post on the website, it can be a time consuming project. Especially when the files are saved to a folder deep within a website and the software used to create the PDF doesn't remember the last folder saved to. Instead of clicking folder after folder for each file, let's look at folder shortcuts. Continue reading →
Excluding Website Traffic Based on an IP Address in Google Analytics
November 28, 2011 — Tags: Google Analytics
Tracking the usage of your website can be very insightful. It helps identify which pages are the most popular, shows where your visitors are from, what browsers they use, etc. However, if you're visiting the website all the time to verify things are working, updating pages, etc. it can throw off the stats. So unless you're trying to pad the numbers, let's look at filtering out results by IP address in Google Analytics. Continue reading →
Sorting HTML Data Tables Part 2: Dynamically Sort in Ascending and Descending Order
November 19, 2011 — Tags: database, HTML, PHP
In last week's post we looked at dynamically sorting HTML data tables. But we only talked about sorting the columns in either ascending or descending. If the user is looking for a last name that appears near the end of the alphabet and the column is sorted from A to Z, they may have a lot of names to go through before finding the one they want. Instead we could provide an option for sorting in both descending and ascending order. Continue reading →
