• jbh

    (@jbh)


    Hey,

    I can create my plug-ins and create admin navs and basically do everything I want except for one thing; I cannot load functions unless they are pages in my plug-in nav panel. This is a problem because I have functions that the user doesn’t link to directly but are still needed.

    Imagine having a link called “Adjust Membership Settings” and sublinks to that would be

    Add/Edit/Delete. Well, I don’t want to put ‘add/edit/delete’ in the nav panel, I just want to link to them so they load dynamically instead of having to put all of the functionality of those 3 functions into one page function.

    How can I go about loading these 3 functions even if they are not pages?

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • The easiest way is generally by example, so what i’d suggest (and what i’d do) is look at how other plugins do it. Quicker to download a few plugins for looking at then to spend hours trawling through search result after result..

    Thread Starter jbh

    (@jbh)

    I would lose a lot of time searching. Is there not a native way via the codex to just call it?

    If page=function is how we load a function that is listed as a page, is there not a sure fire documented way?

    Possibly, i’m not really in a position to answer that question, i’m just sharing how i’d tackle it if i couldn’t find a documented way..

    For what it’s worth, not all the codex pages will cover a function in depth enough to be of much use anyway, seeing implementation of code is usually more reliable in these cases.

    You could also try the hackers mailing list, you might get a more direct answer there (failing others replying here).
    https://lists.automattic.com/mailman/listinfo/wp-hackers

    Thread Starter jbh

    (@jbh)

    Than you. I just can’t believe something so useful, and basic, is so hard to find.

    I’m still toying with PHP Classes myself, but i believe you can reference a function of a class as a page ..

    Inside your classes function it would look something like..

    add_options_page( 'Page Title' , 'Menu Item Name' , 8 , __FILE__ , array( &$this , 'yourfunctiontocall' ) );

    ..( i think ).. purely an example..

    Still wrapping my head round the whole class thing… OOP wasn’t about when i first started using PHP powered apps (or at least it wasn’t quite as popular)..

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Admin Codex Question – Load Function That’s Not A Page…’ is closed to new replies.