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.

Saturday, April 29, 2017

Shortcode in Worpdress


How to use Shortcode in Worpdress

In current post we are going to show in simple way how to create register our own shortcode in wordpress and use it in wordpress website either in Page, post or widget area. To create our own shortcode we use Wordpress function add_shortcode and put it in your active theme fucntions.php file In following sample code we register our own shortcode numberbox
add_shortcode('numberbox','ls_fn_numberbox'); 
function ls_fn_numberbox($atts, $content = null)
{
   extract(shortcode_atts(array('content' => '','fontsize' => '','color' => '#000','background'=>''), $atts));
 ob_start();

 ?>
 <span style="color: <?php echo $color ?> font-size: <?php echo $fontsize; ?>px; background:<?php echo $background ?> padding: 5px 12px"><?php echo $content; ?></span>
 <?php
 return ob_get_clean();
}
Now you can use our register shortcode anywhere in Page, post editor area or in widget area by simple code format like

[numberbox content="101" fontsize="30" color="#fff" background="#0ac775"] and it will look like

Custom Menu in Wordpress


Working with Wordpress premium or custom design theme and need additional menu in your Wordpress? Cool, Wordpress allow us to add number of menu according our need by simple register custom menu in WP using WP function register_nav_menu
<?php
add_action( 'after_setup_theme', 'register_my_menu' );
function register_my_menu() {
  register_nav_menu( 'top_menu', __( 'Top Menu', 'theme-text-domain' ) );
}

//top_menu (required) which is Menu location identifier, like a slug.
//Top Menu (required) Menu description which for identifying the menu in Back-end Appearance >> Menus .
?>
After finish Custom menu registration in WP now its time to assign some menu elements which we want to display by them.
Go to Wp-admin >> Appearance >> Menus
create your new Menu with add Menu Elements (Page, Post, Category or Custom Link) and assign it your created custom menu. in our cases Customer Register menu 'Top Menu' see below image...



Now its time to get display custom register menu in front end. point code location where you want to set New register menu.
If you want to set it in header area than find your active theme header.php and add following code

<?php
    
if ( has_nav_menu( 'Top Menu' ) ) {
    wp_nav_menu( array(
 'theme_location' => 'top_menu',
 'container'      => false,
 'menu_class'     => 'lfloat',
     ) );
   }
?>

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.