Monday, June 29, 2015

Disable Update Notification in Wordpress Without Plugin


WordPress provide auto update functionality for update all sources and plugin with the latest updated from it's admin panel which is called `wp-admin`. After some specific time or event update function of Wordpress finds the latest version of exiting resources from the internet and also provide direct download and install to current resource functionality.
This is very nice functionality for use latest version and updated functions and supports of Wordpress. But Sometimes when you make some customize of Wordpress functionality by modification of files than when you upgrade than previous updated files removed and replace it to a new file and again make changes to new file according to theme or customization so that time must stop upgrade the latest version of Wordpress resource.
When an update available than in admin panel display notification for update version so you must remove that notification for stop update.
In Wordpress there are three types of  update.

1) Wordpress Core Update 

This update is for change Wordpress version to latest version and update all Wordpress core functionality and files which are in `wp-include` and `wp-admin` folder.Wordpress core update notification display at the header of the admin panel. so remove that notification by two ways.
  • Edit File
    For stop Wordpress core notification just set Wordpress version to latest version.Wordpress define it's version as global variable as `$wp_version` in wp-include/version.php file.So just change new version in that variable.For these changes must check Mysql and PHP version and comparability.
  • Modifying Core Functions
    Wordpress check latest version according to last checked time so changed that time to latest time.for that add below function in theme `function.php` file
    
    function remove_core_updates(){
     global $wp_version;
     return(object) array('last_checked'=> time(),'version_checked'=> $wp_version);
    }
    add_filter('pre_site_transient_update_core','remove_core_updates');
    

2) Wordpress Plugin Update

Wordpress plugin update notification display in `Update` and `Plugins` menu so remove that notification as below.
  • Edit File
    For stop Wordpress plugin update notification just change the version to latest version in the plugin main file where define plugin name and description.
  • Modifying Core Functions
    Add below function in theme `function.php` file or plugin file.
    
    function remove_plugin_updates(){
     global $wp_version;
     return(object) array('last_checked'=> time(),'version_checked'=> $wp_version);
    }
    add_filter('pre_site_transient_update_plugins','remove_plugin_updates');
    
    or use below code for any specify plugin
    
    function stop_plugin_updates( $value ) {
        unset( $value->response['akismet/akismet.php'] ); //Plugin file name
        return $value;
    }
    add_filter( 'site_transient_update_plugins', 'stop_plugin_updates' );
    

3) Wordpress Theme Update 

Wordpress theme update notification display in `Update` and `Appearance` menu so remove that notification as below.
  • Edit File
    For stop Wordpress them update notification just change the version to the latest version of theme `style.css` file where theme name and description define.
  • Modifying Core Functions
    Add below function in theme `function.php` file.
    
    function remove_plugin_updates(){
     global $wp_version;
     return(object) array('last_checked'=> time(),'version_checked'=> $wp_version);
    }
    add_filter('pre_site_transient_update_themes','remove_theme_updates');
    
Here when you changes in a file for remove update notification than every time you make changes in the file whenever a new update available. So it's better to add new functions for stop update notification. Here single function use for stop all Wordpress notifications as below.

function remove_all_updates(){
 global $wp_version;
 return(object) array('last_checked'=> time(),'version_checked'=> $wp_version);
}
add_filter('pre_site_transient_update_core','remove_all_updates'); // Core update
add_filter('pre_site_transient_update_plugins','remove_all_updates'); //Plugin update
add_filter('pre_site_transient_update_themes','remove_all_updates'); //Theme update

Saturday, June 27, 2015

Add or Remove Table Rows Using jQuery

When you create any dynamic HTML website than in website must save records. For that you use HTML tables for display records from database or from some array variable. Sometimes in table row data should be added dynamically by input text without no limit and not sure about how much row add or remove. That time you can use buttons to add and remove rows. For that see below code to add and remove table rows using jQuery.
For implement that code or integrate to any table first create HTML table with basic table tags.

<table cellpadding="1" id="tabledata" cellspacing="1" width="100%" border="1">
<thead>
<tr>
    <th>NO</th>
    <th>NAME</th>
    <th>EMAIL</th>
    <th>REMOVE</th>
</tr>
</thead>
<tbody>
<tr>
    <td align="center">1</td>
    <td align="center"><input type="text" /></td>
    <td align="center"><input type="email" /></td>
    <td align="center"><input type="button" class="removebutton" value="REMOVE" /></td>
</tr>
</tbody>
<tfoot>
<tr>
    <td colspan="4" align="right"><input type="button" class="addnewbutton" value="ADD NEW" /></td>
</tr>
</tfoot>
</table>
 
Now you want to set add and remove row data by click on `Add New` and `Remove` button, then use jQuery for that put live latest jQuery link from https://jquery.com/download on your page as below.

<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
 

Add new table row using jQuery

For an added new row with name and email id input text when click on add a new button on above table, then adds jQuery event as script on `Add New` button click. for that assign class `addnewbutton` for that button as above table and script as below.

<script>
$(document).on('click', '.addnewbutton', function (){ //Add new row below Add New button row
$(this).closest('tr').before('<tr>'+
    '<td align="center">1</td>'+
    '<td align="center"><input type="text" /></td>'+
    '<td align="center"><input type="email" /></td>'+
    '<td align="center"><input type="button" class="removebutton" value="REMOVE" /></td>'+
    '</tr>');
     return false;
 });
</script>

Add row with number

Here for adding new row you want to also add an auto increment number for count total records than using jQuery find total table rows and then add an extra row of that table according to the next increment number. For that add `tabledata`as table id as above table and script as below.

<script>
$(document).on('click', '.addnewbutton', function (){
var totaltr = ($("#tabledata").find('tr').length) - 2; //For calculation of data row after remove table head and footer
$(this).closest('tr').before('<tr>'+
    '<td align="center">'+(totaltr + 1)+'</td>'+ //Add next increment value for new row
    '<td align="center"><input type="text" /></td>'+
    '<td align="center"><input type="email" /></td>'+
    '<td align="center"><input type="button" class="removebutton" value="REMOVE" /></td>'+
    '</tr>');
     return false;
 });
</script>
 

Remove table row using jQuery

For removing any row and its data when click on remove button in a table than add jQuery remove function use. For that create new class `removebutton` for each new Remove button and remove table row script as below.

<script>
  $(document).on('click', '.removebutton', function (){
      $(this).closest('tr').remove();
 });
</script>

Wednesday, June 10, 2015

IOS 9 improve iPhone Battery Life with 'Low Power Mode'

Apple industry IOS 9 improve battery life as three hours extra with 'Low Power Mode' And Performance Tweaks on compatible devices.The company’s latest mobile operating system, apps and features have been optimized to reduce power consumption from Apple smartphones.
Apple giving a preview of iOS 9 for new iPhone, iPad and iPod touch software.In that new 'low power' mode makes iPhones last longer as focuses on speed, reliability and a smarter Siri with new update which was unveiled on Monday.Meanwhile, Google is making similar features like battery life and speed in the next version of its own operating system,called Android M.
Apple always make best features for new version of IOS which is use most reliable and high performance and user friendly for easily uses.for improve battery life When switched on Apple OS on smartphone or ipad, emails are only fetched manually, background app refreshes and downloads are disabled, motion effects and brightness are reduced, network speeds may be slowed and animated wallpapers are disabled so it's reduce power consumption and improve battery life more than normal.

Valid Wordpress Comment Before Submit

For Wordpress Blog comment is most important for make complete Wordpress blog website and comment features.When you create any any wordpress website than comment is also include in default wordpress functionality.Wordpress also allow comment on any page and custom create post type.
If you want to remove comment functionality for page or post than edit that post and remove discussion check box in discussion meta box.If you want to remove comment functionality from any post type than remove 'comments' in `register_post_type`'s 'supports' parameters.
When you use Wordpress default comment functionality than  when any use click on submit button without enter name,email and comment than it's display blank screen and error display as below.

ERROR: please fill the required fields (name, email).

So if you want to change this steps and do not accept form without enter validation field than must validate comment form before submit using jQuery validation.
  1.  Download latest jQuery Validated file from http://jqueryvalidation.org/
  2. Call script file in header.php file of current theme directory as `
    <script src="<?php bloginfo('template_directory');?>/js/jquery.validate.js"></script>
    `
  3. Open comment.php file of theme (If not exits create new based on Wordpress default theme) and enter validation script for comment form as `jQuery("#commentForm").validate();`
Now without email,text and comment text not accept comment form and it's validated using jQuery validation.

Thursday, June 4, 2015

Solve Unknown collation: 'utf8mb4_unicode_ci' Error in Wordpress

If you use Wordpress for Blog/Website or are you Wordpress developer than must know import and export database for upload website on live or move website from one server to another server.
If you want to change Wordpress website server live to local or move website than another server than first export old Wordpress database and than upload it to new server than sometimes you fetch below error in cpanel phpMyAdmin.

#1273 - Unknown collation: 'utf8mb4_unicode_ci'

This error because of change php version if php version is higher than 5.5 than it save all database as 'utf8mb4_unicode_ci' and that database import to lower version of cpanel than it's display below error. Solve that error just exporting database according to below step for import it on lower version of PHP.

1) Select database of phpmyadmin.
2) Click on 'Export' tab on database.
3) Select `Custom` Export Method.
4) Select tables from list of all database tables for export.
5) Select `Format-specific options`->'Database system or older MySQL server to maximize output compatibility with' MYSQL40 instead of NONE.
6) Click on GO button at bottom for export.
7) Save exporting database.

Now import new exporting database to new server it's install successfully.Here from below step 5th step is most important and compulsory for solve 'Unknown collation' error.

Install Multiple WhatsApp On Same Android Phone

Now in many counties peoples use dual SIM mobile for own purpose or business mostly in India peoples use dual SIM because of many mobile network service provide functionalists and costing.So many new brand launched them latest smart phones with dual SIM.
With the dual SIM functionality peoples also want some application functionality for dual SIM like as WhatsApp which is most popular and famous application for message chatting.So every person looking for that how to install dual WhatsApp according to them dual SIM.
Here simple steps for installing dual WhatsApp using OGWhatsApp application.
  1. Tack backup of your running WhatsApp from WhatsApp Application  Settings > Chat Settings > Backup all chats.(If you want to tack backup of running WhatsApp )
  2. Now clear all WhatsApp data from Settings > Applications > WhatsApp > Clear Data for remove all current WhatsApp data.
  3. Now look at your File Manager where you can find WhatsApp folder in internal storage or memory card.
  4. Rename that folder name WhatsApp to  OGWhatsApp
  5.  Now uninstall WhatsApp App from your device (from step 2)
  6. Download latest version of OGWhatsApp from here.
  7. After download install OGWhatsApp and run application on your device with your old number.(For get all backups of previously installed WhatsApp)
  8. Now download new WhatsApp from Play Store install and configure it with new number.
Now in your device 2 WhatsApp with two difference numbers.Accoring to that you can also use multiparty WhatsApp by download ENWhatsApp and SAWhatsApp (Installation same as OGWhatsApp). You can also run multiple WhatsApp by some Multiple Accounts apps like SwitchMe.