• Hi,

    I’m developing a plugin for WordPress, I’ve got a page with a table which displays some data and I want the user to be able to add/edit data by opening up a thickbox with an edit page to enter the data.

    The way my plugin works so far is I have added a menu item to the admin area using

    add_menu_page(…);

    In the function provided for the add_menu_page() I have a switch statement to decide which what to show, it looks something like this

    switch ($_GET["pluginaction"])
    {
    case 'add':
        show_add_page();
        break;
    case 'edit':
        show_edit_page();
        break;
    default:
        show_list_page();
    }

    and the I can switch between them using
    https://adminurl/admin.php?page=mypluginpage&pluginaction=edit

    So my first question is; is this a reasonable way to approach this or is there a better mechanism in the WordPress framework?

    Secondly, I’m trying to use the following javascript to bring up the edit page in a thickbox

    jQuery(".clickablebits").click(function(event) {
        var url = 'https://adminurl/admin.php?page=mypluginpage&pluginaction=edit&item='+event.target.id;
        tb_show('The Title', url);
    }};

    Which works great apart from the admin theme appearing again inside the thickbox.

    So the second question is; how to I get the thickbox to display this action but without the full admin template appearing?

    Many thanks and I look forward to your replies! ??

  • The topic ‘Plugin architecture and thickbox’ is closed to new replies.