php
Get URL of Current Page With PHP
Learn how to get the URL of current page with php. Understand the differences between $_SERVER[“SERVER_NAME”] and $_SERVER[“REQUEST_URI”]
WordPress Add Allowed File Types
The WordPress media uploader is a great tool that allows you to easily include images, videos, documents, and audio on your site. One of the security features associated with the WordPress media uploader is that you are only allowed to upload specific file types. This WordPress Add Allowed File Types tutorial will show you how you can include additional filetypes in your list of allowed uploadable files.
Simple PHP File Upload Script
PHP Display Number as Money
Add Class to Body WordPress
Here is a quick snippet you can use to programmatically add a class to the body element in WordPress.
print_r pre
When you are using a print_r in php, it’s a very good idea to remember the print_r pre combo (ie wrap the print_r in a pre tag). The difference being that using pre will allow you to understand the output as it will be preformatted in a way that is easy for humans to see…
Copyright Current Year PHP
One trick that I often use when building a site is to set the copyright year in the footer (or anywhere else you may want it) to always display the current year. This way, in the future you don’t have to worry about remembering to update it manually. Here’s how to do it in…
Twitter API 1.1 Example
In the footer of this website, I show my latest tweet. Until now I had been using Twitter API 1.0. Today Twitter stopped service for API 1.0 and I had to scramble to fix it so that it would work with Twitter API 1.1 (turns out it’s a lot more complicated). Here is the code…