• Pamela

    (@infoknutsford-softwarecouk)


    What is the easiest way to add a new link to the left hand navigation in the admin side to a php page. I want to add a page containing a form. Do I do it as a plugin somehow? Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • This goes over adding menu items. https://codex.www.ads-software.com/Adding_Administration_Menus

    I would recommend sticking to the standard options page format if you’re adding a page with some sort of form to the admin side. That’s discussed Here

    Thread Starter Pamela

    (@infoknutsford-softwarecouk)

    Under wp-contnet/plugins i have created a libray called courses.. UNder courses I have a page called courses.php. This contains

    <?php
    add_action(‘admin_menu’, ‘course_create_admin_menu’);
    function course_create_admin_menu() {

    add_object_page(‘Course Dependencies’, ‘Course Dependencies’, ‘manage_options’,’course dependencies’, ‘course_order’);
    }

    function course_order() {
    ?>
    <div class=”wrap”>
    <h2>Course Dependencies/h2>

    </div>
    <?php
    }
    ?>

    No link appears in the admin menu though. What am I doing wrong? Thanks

    For the most part that looks right, but I do see 1 typo.

    On line 5 your have “add_object_page” … that should be options, not object.

    add_options_page('Course Dependencies', 'Course Dependencies', 'manage_options','course dependencies', 'course_order');

    I’m also assuming that you have it in either your theme’s functions.php file or in a plugin file with a correct plugin header so that you can activate it. If its not in either of those places, the code won’t run.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add new link’ is closed to new replies.