How to create Triangles using CSS

Many times we come across cases where we want to have triangles, arrows or simple shapes on a site. Usually we use images to add arrows or triangles. However, this can be easily achieved by just using CSS and no need of images at all. In this post we will see how to easily we can create triangles and a few other designs using CSS.

The borders in a browser are drawn at angles, so we can use this technique to create triangle. To create a triangle we will set the border-width value for the side in which we need the arrow. Then, we will set that side’s border color and make all other sides transparent. Also, we set the width and height of the element to 0.
Read more »

How to add featured image to WordPress RSS feed

Recently I came across a situation when I wanted to add the featured image of the posts to my RSS Feed. By default WordPress does not shows the Featured Image in the RSS Feed. This can be easily achieved by adding a few lines of code in the functions.php file of the theme.

Important: Make sure to add the code to the functions.php file of your theme. Do not add it to the functions.php file in the wp-includes directory.
Read more »

How to hide Nginx version number in headers and errors pages

In default Nginx configuration, the server sends HTTP Header with the information of Nginx version number of the Server. The HTTP response header “Server” displays the version number of the server. This information can be used by hackers to try to exploit any vulnerabilities in the Nginx, specially if you are running an older version with known vulnerabilities.

Sample HTTP Response Header:

HTTP/1.1 200 OK
Server: nginx/1.2.6 (Ubuntu)
Date: Wed, 31 Jul 2013 19:47:33 GMT

Read more »

Big forms and PHP max_input_vars

Recently I was working in WordPress to create a big menu, with over 75 links in it. When I created it and tried to save it got save only partially, few menu items at the end got truncated. I was not sure what happened. So then I tried to add 1 more link and it was not saving. Then I decided to check if there were any PHP errors. I found the following in the error logs:

PHP Warning: Unknown: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini. in Unknown on line 0, referer: http://mysite.com/wp-admin/nav-menus.php

Then I found out that there is a PHP setting “max_input_vars” (available since PHP 5.3.9) which limits the number of variables that PHP will process. If this value is 1000 (default is 1000) PHP will process first 1000 variables and drop the remaining. This was the reason why some menu items were saved and some not.
Read more »

How to change WordPress username

By default when you install WordPress, the username is “admin”. If someone is trying to hack into your site the first username they would try is “admin”, and if you use “admin” all they have to now do is guess your password. So, it is highly recommended that you never use “admin” as the username used to login into WordPress. You can choose a different username while first installing WordPress. However, you cannot change your username once created.

You can change the username by running queries in the database or use different plugins for it. However, there is a much simpler way to change your username. In this post lets see how we can change the “admin” username (you can use similar steps for any other username).
Read more »