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

时间:2015-10-21 04:42:17

标签: php plugins wordpress-plugin wordpress

我想创建一个wp插件来显示数据库中的记录。我在数据库中添加了一个表,想要在post.php页面编辑器下的wp-admin post.php页面中获取并显示记录。

我在我的表中将post_id作为外键。所以我想获取所选post_id的记录。

这是我的插件代码.....

<?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');
?>

1 个答案:

答案 0 :(得分:0)

将add_meta_box函数用于页面编辑器下面的节目记录

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