Last active
December 11, 2016 06:41
-
-
Save yuikns/e29bb87cbcf7f4343d76e721139347ef to your computer and use it in GitHub Desktop.
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 | |
// return location from user ip | |
require 'IP.class.php'; | |
$rip=$_SERVER["REMOTE_ADDR"]; | |
$lar = Ip::find($rip); | |
$i = count($lar) - 1; | |
$loc = "地球"; | |
while($i >=0 ){ | |
if(strlen($lar[$i]) > 0 ) { | |
$loc = $lar[$i]; | |
break; | |
} | |
$i --; | |
} | |
echo $loc; |
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: SomeMoreSentence | |
*Version: 0.1 | |
*Plugin URI: http://argcv.com | |
*Description: append some more sentence after the end of your post | |
*Author: Yu Jing | |
*Author URI: http://argcv.com/about | |
*/ | |
function SomeMoreSentence($outer){ | |
if(!is_singular()){ return $outer; } | |
global $post; | |
$tmp = "<blockquote>来自<a id='remote_loc'></a>的你,很高兴你能看到这儿。若本文对你有所用处,或者内容有什么不足之处,敬请毫不犹豫给个回复。谢谢!</blockquote><script type='text/javascript'> | |
$(document).ready(function(){ | |
$.get('/api/ip/', function(data,status){ | |
$('#remote_loc').text(data); | |
}); | |
});</script>"; | |
$outer = $outer.$tmp; | |
return $outer; | |
} | |
add_filter('the_content', 'SomeMoreSentence'); | |
//add_filter('the_content', 'SomeMoreSentence',11);// the bigger the number is ,the latter .. | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment