Last active
August 29, 2015 14:16
-
-
Save vaurdan/c0d441e4b514d992c9d5 to your computer and use it in GitHub Desktop.
Get the IP address of a given hostname. Use it on a WordPress blog with a easy to use shortcode.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Shortcode for IP | |
Description: Get's an IP from an hostname | |
Author: Henrique Mouta | |
Version: 1.0 | |
Author URI: http://henrique.mouta.org/ | |
*/ | |
add_shortcode( 'get_ip', function( $atts ) { | |
$attributes = shortcode_atts( array( | |
'host' => 'google.com', | |
), $atts ); | |
return gethostbyname($attributes['host']); | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment