jQuery animate scrolltop working in Chrome but not in Mozilla

Sometimes below code not work in Mozilla

// Animation to top
$(‘html,body’).animate({scrollTop:0}, ‘slow’);

Reasons:

Check html, body “overflow” in CSS

remove below CSS

html, body{
overflow: hidden;
}

How to increase wordpress site page speed insights

Please find below steps to increase Google Page speed  insights…

1. Add w3 total cache plugin within wordpress site.
2. Activate page cache, browser cache, database cache etc… in w3 cache plugin.
3. Optimize images with wordpress using WP Smush Plugin or with the help of designer.
4. Install “Google Pagespeed Insights” plugin to check page by page performance.
5. Install “Autoptimize” plugin and set CSS & JS optimization.
6. Finally insstall WP Performance Score Booster to increase page speed insights.

Now website max  Page Speed Insights more than 86 for desktop and more than 70 for mobile.

 

HTTP Error 404.3 – Not Found The page you are requesting cannot be served because of the extension configuration. If the page is a script, add

If this is related IIS 7.5 Detailed Error – 404.3  – Not Found

We need to map json or CSS like blow

1- Open your project’s Web.config file
2- Under <system.webServer> add the MIME mapping to handle the file extension you need, like so:

Screenshot_1

 

 

 

 

3- Rebuild the solution and watch for the same error. Most likely this should resolve the issue handling .less files. You can add handlers for any type of file with another <mimeMap fileExtension=” mimeType=”” />

Change instance type aws,resize ec2-instance

Please find below steps to “Change instance type aws,resize ec2-instance

  1. Login into AWS console.
  2. Go to EC2 Dashboard -> Instances.
  3. Select Instance which is you need to change type or size.
  4. Select Actions -> Instance State -> Stop.
  5. It will give one popup window “Stop Instance” like “Are you sure you want stop these Instance?”. Click on “Yes, Stop“.
  6.  When instance stoped Public DNS, Public DNS set to empty.
  7. Next go to Actions -> Instance Settings -> Change Instance Type -> Select instance type like example “m3-medium“.
  8. Next Select Actions -> Instance State -> Start.
  9. After change Instance Type -> Public DNS, Public DNS changed to new.

Find video here https://www.youtube.com/watch?v=KongDsEdboA

Simple login form shortcode using wp_login_form() function

//Shortcode [login_form]

add_shortcode(‘login_form’, ‘custom_login_form_shortcode’);

function custom_login_form_shortcode( $atts, $content = null ) {
extract( shortcode_atts( array(
‘redirect’ => ”
), $atts ) );

if (!is_user_logged_in()) {
if($redirect) {
$redirect_url = $redirect;
} else {
$redirect_url = get_permalink();
}
$form = wp_login_form(array(‘echo’ => false, ‘redirect’ => $redirect_url ));
}
return $form;
}

PHP String functions with examples

<?php
Please find below string functions in daily use

//trim()
trim() : It removes all the whitespaces from both sides of a string,
ltrim() and rtrim() for removing them from only one side of the string (left or right).

//explode
It convert string to array based on comma, space etc…
Ex: echo explode(” “,$arr); // Array

//implode
It convert array to string
Ex: echo implode(” “,$arr); // String

//str_replace
It’s used for replace word
Ex: echo str_replace(“world”,”Peter”,”Hello world!”);
//world replaced with peter

//preg_replace
Perform a regular expression search and replace
Ex: $str = preg_replace(‘/\s+/’, ”, $str);
// But if it could be due to space, tab…you can use

//md5
It encode’s the string

//str_split
Splits a string into an array

//strcmp
Compares two strings (case-sensitive) returns ‘0’ when true.

 

we are having lot of string functions please find below URL….

http://www.w3schools.com/php/php_ref_string.asp
?>

Get options in wordpress

<?php

// Admin Email
$admin_email = get_option(‘admin_email’);

// Site url
$site_url = get_site_url();
bloginfo(‘url’);
get_bloginfo();

//site_url()
The site_url() will always be the location where you can reach the site by tacking on /wp-admin on the end,
while home_url() would not reliably be this location.

//home_url()
The home_url() would be where you have set your homepage by setting General > Settings “Site Address (URL)” field.

//Get date format from wordpress settings
$date_format = get_option(‘date_format’);

//Get time format from wordpress settings
$time_format = get_option(‘time_format’);

//Get start of week from wordpress settings
$start_of_week = get_option(‘start_of_week’);

//Get timezone from wordpress settings
$timezone_string = get_option(‘timezone_string’);

//No of posts
$posts_per_page = get_option(‘posts_per_page’);

//Check Search Engine Visibility or not
$blog_public = get_option(‘blog_public’);

//Get thumbnail width & height
$thumbnail_size_w = get_option(‘thumbnail_size_w’);
$thumbnail_size_h = get_option(‘thumbnail_size_h’);

//Medium size
$medium_size_w = get_option(‘medium_size_w’);
$medium_size_h = get_option(‘medium_size_h’);

//Large size
$large_size_w = get_option(‘large_size_w’);
$large_size_h = get_option(‘large_size_h’);

?>

Audio autostart on Android and IOS

Question: I want to audio auto-play in android and iPhone mobiles is it possible?

Answer:

  1. Audio/video autoplay is not allowed on iPhone, iPad and Android. It’s a limit from the device, and there is no way to bypass it.
  2. On both iOS and Android (this includes both mobile and tablet devices) it is not possible to ‘autoplay’ a media file. What this means, in practice, is that you always need a user action to initiate an audio or video play, such as a button click.

Solutions: 

  1. Another autoplay solution, especially applicable to audio, is using audio sprites. Instead of having different audio files you stitch them all together in one big file and move the current time. Another decent solution, but this takes a lot more work and overhead, and is probably unusable for video because of the file size. Also, you can still only play one sound at the same time.
  2. Yet another autoplay solution, only applicable for audio, is to use theWeb Audio API. Here’s an article about how to use it on iOS. Unfortunately the Web Audio API is not supported on any version of Internet Explorer and the stock Android Browser (Chrome for Android does support it), so you need to use other solutions for those browsers. You could try using something like Howler.js to make it work on all platforms.

Article taken from “haykranen.nl”