📄 hello.php
字号:
<?php/*Plugin Name: Hello DollyPlugin URI: http://wordpress.org/#Description:_LANG_PG_HELLO_DOLLYAuthor: Matt MullenwegAuthor URI: http://photomatt.net/*/// These are the lyrics to Hello Dolly$lyrics = "Hello, DollyWell, hello, DollyIt's so nice to have you back where you belongYou're lookin' swell, DollyI can tell, DollyYou're still glowin', you're still crowin'You're still goin' strongWe feel the room swayin'While the band's playin'One of your old favourite songs from way back whenSo, take her wrap, fellasFind her an empty lap, fellasDolly'll never go away againHello, DollyWell, hello, DollyIt's so nice to have you back where you belongYou're lookin' swell, DollyI can tell, DollyYou're still glowin', you're still crowin'You're still goin' strongWe feel the room swayin'While the band's playin'One of your old favourite songs from way back whenGolly, gee, fellasFind her a vacant knee, fellasDolly'll never go awayDolly'll never go awayDolly'll never go away again";// Here we split it into lines$lyrics = explode("\n", $lyrics);// And then randomly choose a lineglobal $chosen;$chosen = wptexturize( $lyrics[ mt_rand(0, count($lyrics) ) ] );// Now we set that function up to execute when the admin_footer action is calledadd_action('admin_footer', 'hello_dolly');if (!defined('WP_PLUGIN_HELLO')) {define('WP_PLUGIN_HELLO',1);// This just echoes the chosen line, we'll position it laterfunction hello_dolly() { global $chosen; echo "<p id='dolly'>$chosen</p>";}// We need some CSS to position the paragraphfunction dolly_css() { echo " <style type='text/css'> #dolly { position: absolute; top: 5px;margin: 0; padding: 0; right: 3em; font-size: 20px; color: #666; } </style> ";}}add_action('admin_head', 'dolly_css');?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -