如何创建一个在wp-admin / post.php页面中工作的wordpress插件

如何创建一个在wp-admin / post.php页面中工作的wordpress插件

问题描述:

I want to create a wp plugin to show record from database. I have added a table in database and want to fetch and show record in wp-admin post.php page under the post.php page editor.

I have post_id in my table as a foreign key. so I want to fetch record of selected post_id.

This is my plugin code.....

<?php
    /*
        Plugin Name: Kiosk User Info
        Plugin URI: http://pixako.com
        Description: This is Kiosk User Info.
        Author: Muhammad Asfund Yar - Pixako
        Version: 1.0
        Author URI: http://pixako.com
    */

    /* Plugin Main Page/Setting Page*/
    function KioskUserInfo_mainPage(){
        echo "<br />This is main page of plugin<br /> Go to the post page. here we are using it. <br /> Thanks";
    }


    /*Plugin Working Area*/
    function KioskUserInfo_postPage(){
        echo "I want this code to show in wp-admin/post.php page under editor.";
    }
    add_action( 'registered_post_type', 'KioskUserInfo_postPage' );


    /*Menu Links*/
    function KioskUserInfo_menu(){
        add_menu_page('Kiosk User Information Plugin','Kiosk User Info', 'manage_options','kiosk-user-info-mainpage','KioskUserInfo_mainPage');
    }
    add_action('admin_menu','KioskUserInfo_menu');
?>

Use add_meta_box function for show records below page editor

https://codex.wordpress.org/Function_Reference/add_meta_box