如何客製WordPress後台的「說明」(Contextual Help)頁面與「顯示選項」(Screen Options)頁面?
原始程式 這裡
<?php /* Plugin Name: PowenKo, hello , I am here Plugin URI: httpss://wordpress.org/plugins/hello-dolly/ Description: This is not just a plugin, it symbolizes the hope and enthusiasm of an entire generation summed up in two words sung most famously by Louis Armstrong: Hello, Dolly. When activated you will randomly see a lyric from <cite>Hello, Dolly</cite> in the upper right of your admin screen on every page. Author: Powen Ko Version: 1.6 Author URI: httpss://ma.tt/ */ add_filter('contextual_help', 'custom_help2', 1, 3); function custom_help2($contextual_help, $screen_id, $screen) { global $my_plugin_hook; // 判斷若目前畫面的screen_id是我們的plugin hook id,就顯示對應的說明內容 if ($screen_id == $my_plugin_hook) { $contextual_help = '您好,歡迎使用My Plugin!'; } else { $contextual_help .= '<h3>您好,目前頁面的screen_id為:'.$screen_id.'</h3>'; } return $contextual_help; } add_filter('screen_settings', 'screen_options_demo2', 1, 2); function screen_options_demo2($current, $screen) { $current .= '<b>此頁的screen id為:'.$screen->id.'</b>'; return $current; } ?>