Wednesday, 19 August 2015

WooCommerce - Add Indian Rupee Symbol

Indian Government has launched its new currency symbol for Indian Rupee.

In WooCommerce we are not able to view our symbol and also many developers are not able to add it on their website.

If you are using WooCommerce for WordPress and want to add Indian Rupee Symbol in your website just follow the following steps.

STEP 1 : Open function.php file of your theme.

STEP 2: Add the following code in your function.php file and save it

<? 

/*** WooCommerce  Add Indian Currency by Bhushan Bagde ***/

add_filter( 'woocommerce_currencies', 'add_custom_currency' );

function add_custom_currency( $currencies ) {
$currencies["INR"] = 'Indian Rupee';
return $currencies;
}

add_filter('woocommerce_currency_symbol', 'add_custom_currency_symbol', 10, 2);

function add_custom_currency_symbol( $currency_symbol, $currency ) {
switch( $currency ) {
case 'INR': $currency_symbol = '&#8377'; break;
}
return $currency_symbol;
}


?>

Now, goto WooCommerce > Settings > Select Indian Currency.

That's it.

Thank You

Friday, 7 August 2015

Remove .html or .php extension with .htaccess

.htaccess is a file which will help you to do
  1. Redirect the user to different page.
  2. Password protect a specific directory
  3. Block users by IP
  4. Preventing hot linking of your images
  5. Rewrite URIs
  6. Specify your own Error Documents

Removing Extensions

To remove the .php extension from a PHP file
for example the domain url is example.com/home.php and you want to change intoexample.com/home  so here you have to add the following code inside the .htaccess file:
<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteRule ^([^\.]+)$ $1.php [NC,L]
 </IfModule>


To remove the .html extension from a html file
If you want to remove the .html extension from a html file for example example.com/home.htmlto example.com/home you have to add the following code inside the .htaccess file:
<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]
</IfModule>
That’s it! You can now link pages inside the HTML document without needing to add the extension of the page. For example:
<a href="http://www.example.com/services">services</a>