WordPress.org

Ready to get started?Download WordPress

Forums

Object Oriented Plugin Posting/Linking to a class. (1 post)

  1. OrgoneTX
    Member
    Posted 10 months ago #

    If I want to post to one of my classes or link to it, I am currently using the following logic. Is there a better way to do this? Thanks in advance.

    //instantiate the object
    $path1 = ABS_CONTROLS_PATH . 'class.admin.myclass.inc';
    require_once $path1;
    $myclassObj = new myclass();
    
    //Create a hidden page,
    //that basically just points to the function and class.
    add_submenu_page( "", "Do Something", "", "manage_options", 'admin-myclass-dosomething', array($myclassObj, 'dosomething') );
    
    //Then create a constant for the link
    define("CATEGORY_ACTION_DISPLAY", '?page=admin-myclass-dosomething', true);	
    
    //Then the link looks like this
    http://wp1.localhost/wp-admin/admin.php?page=admin-myclass-dosomething&id=BDBED1D3-2D41-11E3-8485-79F665153CEA

Reply

You must log in to post.

About this Topic