Create Function :
function ipInfo($ip) { if(isset($ip)) { $data = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip='.$ip)); if($data['geoplugin_status'] == '200') { return $data; } else { echo "Bad request!, Error code is ".$data['geoplugin_status']; } } else { echo "IP is not set!"; } }
Result :
|
Tuesday, 4 April 2017
Find location from IP .
How to close tab in JavaScript Event.
<script>
window.onbeforeunload = function () { alert("Do you really want to close?"); };</script>
How to Add Colorpicker in wordpress.
Add function.php
function jcorgytce_enqueue_color_picker() {
wp_enqueue_style( 'wp-color-picker' );
wp_enqueue_script( 'script_handle', plugins_url('your_javascript_file.js', __FILE__ ), array( 'wp-color-picker' ), false, true );
}
add_action( 'admin_enqueue_scripts', 'my_color_picker_function' );
Add JS file :
<script type="text/javascript">
jQuery(document).ready(function($){
$('.color-picker').wpColorPicker();
});
</script>
<input type="text" class="color-picker" name="overlay_color" value="#EEE" data-default-color="#effeff" />
|
Subscribe to:
Posts (Atom)