BuddyPress the social networking plugin for WordPress sends an activation email when a new user registers. This email is very plain so why not add some spice to it by having your custom email. There are many forum threads out there for this topic but 99% of them don’t mention if their method is for single site or multi site. So I spent a lot of time trying customize this activation mailer without any success. Finally I sank into the code of BuddyPress and found the right set of hooks for the each environment – single or multi site.Continue Reading…
Custom 403 and 401 error pages in WordPress
Earlier I had written an article on custom error pages for Apache but doing the same with WordPress is not that straightforward. WordPress has the ability to handle 404s internally but doing the same for other 4xx errors requires modifying the code.
I’ve been searching how to do this for months without luck. Recently after I created my own theme for this blog I got some knowledge of WordPress internals.
I put that to use and after several hours of experimenting built the 403 and 401 custom error pages for my WordPress blog.Continue Reading…
Redirecting WordPress archives to a page
WordPress started as a blogging platform but soon evolved into a Content Management System (CMS) used to create full websites. But certain features meant for a blog doesn’t suit well for websites and one among them is displaying archives. An archive in a blog contains a list of “posts” based on date, category or author, sometimes even bloggers (like me) don’t like to displaying date archives. So I decided to redirect the date archives in my blog to the home page without using any plugin and in the process also learnt redirecting category archives to other wordpress pages also. There are many ways to do this like editing the .htaccess file or using a plugin and here I’ll be editing the wordpress PHP theme files.Continue Reading…
apc.php Download
PHP APC (Alternative PHP Cache) is a framework which speeds up PHP applications by storing the result of compiled PHP programs in the memory a.k.a. caching. The apc.php file is available in the APC package if downloaded as source from the APC page of the PECL website, but if you have installed it from the Linux repository by using the command yum install php-apc or apt-get install php-apc this file will not be available. I have extracted the apc.php file from the APC source downloaded from the PECL website and it is available for download here.
Download apc.php (12KB)
Extract this file and upload it to your document root, access it from your browser and you will see a page similar to the following.Continue Reading…
Username availability check with AJAX and PHP
Recently the AJAX bug bit me and I started rewriting the code of htdigest generator, htpasswd generator and URL encoder/decoder after learning some basics from w3schools.com. I tried creating a username availability validator using AJAX and it worked well so I am here writing this article on how to do this. I will be concentrating more on the AJAX part and less on PHP because I have already written an article on how to connect PHP and MySQL. In the end of this article there is a link to a demo which I created, it has a HTML form sans form tags 😛 just to demonstrate username validation.Continue Reading…
How to use PHP to minify HTML output
Couple of years ago I wrote an article about two PHP configuration options auto_prepend_file and auto_append_file recently while browsing about PHP minification I got an idea on how to apply this PHP minify code to each and every script executed on the server so that all HTML output from that server are auto minified. This method requires creating a PHP file containing the code to strip whitespaces and newlines before and after the HTML tags and including this file with every PHP script executed on the server using the auto_prepend_file configuration option. For this you need to have access to the php.ini file. This method will work fine even if you are using shared hosting with custom php.ini support.Continue Reading…
- 1
- 2
- 3
- …
- 5
- Next Page »