Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MyPlugin {
- function __construct() {
- add_shortcode('ShowMsg', [$this,'ShowMsg']);
- //add_action( 'admin_menu', [$this,'load_starter_tab'] );
- add_action( 'admin_menu',
- function () {
- add_menu_page( 'Publications Upload', 'Publications Upload',
- 'manage_options', 'ha_pubs_load', [$this,'load_starter']);
- } );
- }
- function ShowMsg($atts) {
- $data = shortcode_atts(array('phn' => '', 'msg' => ''), $atts);
- return 'You sent '.$data['msg'] .' from '.$data['phn'] ;
- }
- /* not necessary see construct */
- function make_shortcode() {
- add_shortcode('ShowMsg', [$this,'ShowMsg']);
- }
- /* not necessary see construct */
- function add_form() {
- add_action( 'admin_menu', [$this,'load_starter_tab'] );
- }
- /* see alternate usage with anonymous function*/
- function load_starter_tab() {
- add_menu_page( 'Publications Upload', 'Publications Upload', 'manage_options', 'ha_pubs_load', [$this,'load_starter']);
- }
- function load_starter() {
- ?><h1>HERE YOU ARE!</h1>
- <?php
- }
- }
- new MyPlugin;
Add Comment
Please, Sign In to add comment