Vijay Lathiya

Php Opensource Developer with writing articles on Php,HTML,CSS,jQuery, Google Map etc technologies area on blogger

Welcome to Vijay Lathiya Blog

I'm very thankfull for visiting my blog.

Wordpress Website development Surat

Google Map API Services

Google Map API V3 for get location with Lat-Long, Distance between two place and many more stuff you will get from my blog

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

Friday, July 10, 2015

Start End Datetime picker with validation

Very useful jQuery script to validate Date range with time picker while you going to offer provision to site user to fill Start Date and End Date and end date must greater than the Start date. Please take a look to below jQuery script that allow you same thing. with select date and time DateTimePicker jQuery plugin you can use below script very easy.

   $('#offer_start').datetimepicker({
    format:'Y-m-d',
    onShow:function( ct ){
     var start = $('#offer_expire').val();
     var maxDate = false;
     var minDate = false;
     var range = $('#offer_start').data('range');
     if( start !== '' ){
      var date = new Date( start );
      date.setDate( date.getDate() - 1 );
      maxDate = date.getFullYear() +'/'+ (date.getMonth()+1) +'/'+ date.getDate();
      if( range !== '' ){
       date.setDate( date.getDate() - range );
       minDate = date.getFullYear() +'/'+ (date.getMonth()+1) +'/'+ date.getDate();
      }
     }   
     this.setOptions({
      maxDate: maxDate,
      minDate: minDate
     });
    },
    timepicker:false
   });

   $('#offer_expire').datetimepicker({
    format:'Y-m-d',
    onShow:function( ct ){
     var start = $('#offer_start').val();
     var maxDate = false;
     var minDate = false;
     var range = $('#offer_expire').data('range');
     if( start !== '' ){
      var date = new Date( start );
      date.setDate( date.getDate() + 1 );
      minDate = date.getFullYear() +'/'+ (date.getMonth()+1) +'/'+ date.getDate();
      if( range !== '' ){
       date.setDate( date.getDate() + range );
       maxDate = date.getFullYear() +'/'+ (date.getMonth()+1) +'/'+ date.getDate();
      }    
     }
     
     this.setOptions({
      maxDate: maxDate,
      minDate: minDate
     });
    },
    timepicker:false
   }); 

   

Tuesday, July 7, 2015

Shortcode not working in widget Wordpress

Hello Wordpress Developers

Are you working with wordpress shortcode and failure to use it in widget by text area. to make if working 1st make sure your created Shortcode ok as per it structure syntax and once try them to test by adding in Page post content.

if Shortcode working ok that mean no issue with your created shortcode. now check for below filter as it was added in your active themes functions.php or any included file.

add_filter( 'widget_text', 'do_shortcode', 7); 

if not below widget_text filter than you go solution for Shortcode not working with text area widget. just add above syntax in active theme folder functions.php

i believe now your created Shortcode working well with Text Area Widget in Wordpress

Sunday, April 26, 2015

Mobile number & EMail validate in Php

With Php its too easy to validate user entered data using regular expression. here very simple and most required EMail and Mobile number validation Php script with regular expression

Email and Mobile Number Validation using regular expression


To allow user enter only number in textbox instead of validate entered number string length you can also use below syntax

Saturday, January 31, 2015

Top Five Website Speed performance Tools

Today Im going to sharing one of Top Tools with use of it you may test your website and analyse its speed performance with tips how can you improve it and make it SEO and user friendly.

If you look in Google for Online Website speed performance tools than you get many list of tools suggested by bloggers, developers, seo expert but which one best for you to check and improve your site speed performance.

here following are top 5 website speed checker tools that i'm using for test performance of website that is either developed by me or my team member to finally analyse it before delivered project website to client.

Google Pagespeed insight
Pingdom Tools
Web Page Test
GT Metix
Yahoo YSlow

Prevent Gmail to clipping your email

If you are running email marketing campaign and your email size large than there is chance of Gmail clips your email content and now showing complete email. reason is size of Email are 102 Kb or larger. This size is only for HTML file, images that are loaded from an external location are not include. Solution for Prevent Gmail to clipping your email content Minimise HTML Now solution is very simple you need make your HTML document as light as possible and reduce size of your mail by removine all comment, unncesseccory space and compress mail content html so your mail not cutting by Gmail and show complete email to sender user. Remove all comments from your HTML code. A comment like is of course super handy for creating emails in HTML, but takes up unnecessary space in recipients' inboxes. The same goes for tabs, double spaces and white spaces in your HTML code. Eliminate them from your email document before deployment.

 Following are Online Tools that help you to reduce your Mail HTML size by remove space, comment and compress HTML documents


Saturday, January 3, 2015

Lazy Load jQuery for Image loading faster with Page speed improve

Website page load time play an important part for get daily total number of visitor and good rank in search engine like Google, Yahoo Bing. if your site developed according to SEO standard with good quality content with proper maintained keyword ration, images etc but page loading time more compare to average than it is enough to dropped your daily number of visitor, As per survey record if page load time more than 4 sec than 70%  user quit that website and move on another result which are loading quickly.

To decrease website page load time you may follow some techniques that help you reduce your overall page loading time like.

- Divide number of HTTP request on diff diff domain and reduce load on single server
- use Yahoo smushit.com to compress images size maximum possible.
- Combine all possible js and css into one with Minify each.
- use Lazy load jQuery plugin script


Lazy load jQuery plugin load only images which are available in user viewport. while outside of view port images load one by one on user scroll down action. hence it helpful for long page with many images to load page  faster by calling images as per visibility on user screen instead of calling all at once.

jQuery lazy load plugin developer Mika Tuupola also added that "Use of Lazy Load on long web pages will make the page load faster. In some cases it can also help to reduce server load. "
in Wordpress, jQuery lazy load plugin easily integrate by using wp plugin jquery image lazy loading

using below jQuery script you should also achieve almost same benefit. here we assigning images src from image attr on jQuery document loading load event with windows load. add below code in js file or inside page and add class lazy-show to all images element which you want to load with lazy load techniques


Deferring images without lazy loading or jQuery

I'm big fan of Patrick Sexton as he developed many tools that helpful to all like me and other web developer also his every article very powerful with full analysis details. during follow his article i see one of the very good use full article that play big role to load your web page fast even you have many images by loading image without lazy loading or jQuery

How ?

here is the sample script and html for images that he suggest to use like for images 1st load only small image with its binary code
Title of image
Once page load finish replace Image src to original image that you want to render in your web page

for a complete guideline how to load image with out lazy load & jQuery you may visit Patrick Sexton article How to defer images



Saturday, December 27, 2014

Currency convert using Google and Yahoo services in Php

In Php programming, Convert Amount from one currency to another currency is very easy using Google & Yahoo Finance services. even you can direct convert using Google Currency Converter and Yahoo Currency Converter


Currency convert Using Google Finance in Php

<?php

$get = file_get_contents("https://www.google.com/finance/converter?a=$amount&from=$from_Currency&to=$to_Currency");
$get = explode("",$get);
$get = explode("",$get[1]);  
$rawdata = preg_replace("/[^0-9\.]/", null, $get[0]);
$to_amount = $rawdata;
return $to_amount;

?>			

Currency Convert using YAHOOO Finance in Php

<?php
function convert_currencyi($from, $to)
{
  $url = 'http://finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&s='. $from . $to .'=X';
  $handle = @fopen($url, 'r');
  if ($handle) 
  {
      $result = fgets($handle, 4096);
      fclose($handle);
  }
 
  $allData = explode(',',$result); 
  $dollarValue = $allData[1];
        
  return $dollarValue;
        
  //return number_format($dollarValue, 2, '.', '');
}
?>

Tuesday, December 16, 2014

Find Infected Code in Nulled WP theme plugin


Are you Wordpress Developer ?
Good
Are you using nulled Wordpress Theme or Plugin ?
Very Sad

Because, As a Popularity and usage of Wordpress in Web Development field many many website available on Web that provides Premium Wordpress Themes and Plugin at free of cost. it called Nulled Wordpress Theme, Nulled Wordpress Plugin.



Main problem in use of these type nulled Theme and plugin is Security safety. you can not trust them. Because Except Wordpress Official repository all free listed nulled themes and plugins infected with malicious hack code that Harms your website as well as your Business.

 List of Possible harms of nulled free WordPress premium themes / Plugin
  • Access Blog as hidden Administrator or Completely hack
  • Redirect Blog to spam links and Google etc Search Engine not index / remove indexed Pages of blog
  • Display their Ads on Blog
  • Get backlink from your blog to unknowingly site
  • Theme / Plugin Company may take legal action
  • Hosting Company suspend Account
  • Security issue on other hosted same server sites
Now Onward stop to use Nulled Theme and Plugin and also download / Purchase it only from Trusted repository.
Check your Running Wordpress site and make sure it does not infected by any harmful Malicious hacking code.

Check for Malicious codes

After downloading the theme and plugin, The first step you must need to take is to check downloaded themes, Plugin file not infected by virus.

Check for Virus

Go to VirusTotal.com and check by uploading the zip file. If your file is infected than you will get a red signal with list or detected Malicious script and if not then you can move on to next step.

Check unwanted codes in Wordpress blog

Using Exploit Scanner Wordpress free plugin you can check for unwanted codes exist or not in your install wordpress and used other plugins file.

Check encrypted links codes in Wordpress

One another Wordpress free plugin Theme Authenticity Checker (TAC) also very helpful for you in the process of Check installed Theme, plugins not infected by unwanted Malicious code. Theme Authenticity Checker (TAC) Wordpress plugin give you a warning if any encrypted links are found in a theme with with their authenticity result.

Saturday, December 13, 2014

Remove Query String From CSS & Javascript In WP

To see your website Top in Google search result it is required that your site well developed and according to google standard. Site loading time is the most important factor to get good position in Google and other search engine result.

Today, Gtmetrix, Pingdom, Google page speed insight tool etc Many online tools available on web to check site designed or not according to SEO standard.

According to Pingdom & Gtmetrix tool suggestion removing query strings from static resources like css style sheet and java-script url is the higher priority which is considered during the speed test of website which contain query sting in css and javascript file.



Why used query string in CSS JS Url?

Query string with version in url is a method followed by Developer to instantly render new updates and carry the different plugins version details with file. Normally Query string are used for both java-script and style-sheets file calling url.

Why need to remove query string From CSS JS url

As per Pingdom tools suggestion " Resources with a "?" in the URL are not cached by some proxy caching servers. Remove the query string and encode the parameters into the URL for the following resources:"
Some Proxy server not cache the url which has Query string hence to get good speed performance for website it better to store static CSS, Js files store in Browser cache and render quickly on user second visit.

Remove query string from static resources in Wordpress

There are 2 easy method in Wordpress to remove Query String from Static CSS, Javascript file.

# 1 Add Few line code in Wordpress theme function.php file

Very basic Programming Skill required to add following code in current theme function.php file. You can either choose to edit your theme via wordpress dashboard or use ftp software or online file manager from your hosting cpanel.
// Remove query string from static files 

function remove_css_js_ver( $src ) 
{
   if( strpos( $src, '?ver' ) ) 
   {
    $rqs = explode( '?ver', $src );
    return $rqs[0];
   }
   if( strpos( $src, '?rev' ) ) 
   {
       $rqs = explode( '?rev', $src );
       return $rqs[0];
   }
   return $src;
}

add_filter( 'style_loader_src', 'remove_css_js_ver', 15, 2 );
add_filter( 'script_loader_src', 'remove_css_js_ver', 15, 2 ); 


# 2 Use WP Plugin Remove query strings from static Resources

It is very easiest way to deal with Query sting in Wordpress. no need to edit any file or no need back up of Live Database just add and activate remove query strings from static resources plugin.

Still If you have any query or facing problem kindly share in comment.
ion

Saturday, December 6, 2014

301 Redirect Importance in SEO

Are you planing to move your already running website to new platform or in seo friendly url structure that is preferred by  Google SEO team ?

Well, Its good step to run your website with new latest web technologies as well as according to  suggestion of Google search result team.
Im sharing here one important tips that help you keep your traffic without any drop as well as by redirect user and search engine robots crawler to new site url once you migrate old site to new domain or mould in new structure. in such cases its very helpful for good SEO to use 301 Redirection technique and redirect old site indexed pages to relevant new Url.
301 Redirect  mean permanently redirection. it redirect search engine crawler, visitor to new redirection url.




Methods of 301 Redirection

1  301 redirect using javascript

2  PHP for Linux / Unix / Apache put this at the very top of the page

Using Php Script
<?php

header( "HTTP/1.1 301 Moved Permanently" );

header( "Location: http://www.domain.com/new-page-url.html" ); ?>



Using .Htaccess rule
RewriteCond %{HTTP_HOST} ^domain.com$

RewriteRule (.*) http://www.domain.com/$1 [R=301,L]   #add WWW prefix



3 ASP for Windows Servers

<%@ Language=VBScript %> <% ' Permanent redirection Response.Status = "301 Moved Permanently" Response.AddHeader "Location", "http://www.mysite.com/new-page.html/" Response.End %>


4 HTML Page Redirect

<meta http-equiv="refresh" content="0;url=http://www.mysite.com/new-page.html">

Google Search engine team also recommend that use a server-side 301 redirect.

301 redirects are useful in the following circumstances.
- Move site to new domain
- Change url structure of existing site 
- Static website migrate to dynamic platform
- Canonical URL
Access site main/home page with one url if either user hit 
http://www.domain.com
http://domain.com
http://www.domain.com/index.php
http://www.domain.com/home.php
http://www.domain.com/index.html etc etc than redirect user to any one preferred url by 301 redirect

301 Redirect all possible url to one specific url using .htaccess
# Redirect index.php to main domain url

RewriteCond %{THE_REQUEST} ^.*/index.php



RewriteRule ^(.*)index.php$ http://www.domain.com/$1 [QSA]



For IP Canonicalization – Url Canonicalization Solution by htaccess and Web.config visit

More Info  Google Webmaster Support