• Resolved CypherCo

    (@cypherco)


    What have I done πŸ™ The past 2 days I have been trying to add a login/pass field into my menu bar. I’m not very familiar with the editor and am new to code.. I asked everywhere on stackexchange and here with no responses so I took matters into my own hands and tried a few things. This code here was ok, which I added into my functions.php

    /* Custom Login Menu Field */
    add_filter(‘wp_nav_menu_items’, ‘add_login_logout_link’, 10, 2);

    function add_login_logout_link($items, $args) {
    // start buffering
    ob_start();
    // this is the actual form function
    wp_login_form($args); // $args optional see below ..
    // get buffering
    $loginoutform = ob_get_contents();
    // clean buffering
    ob_end_clean();
    $items .= $loginoutform ; // concatenate buffering with items …
    return $items;
    }

    It wasnt placed properly so I tried a new one. The one that just ruined everything. I removed the old one and went to try this:

    $form = wp_login_form( array(
    ‘form_id’ => ‘adminloginform’,
    ‘echo’ => false,
    ‘label_username’ => __(”),
    ‘value_remember’ => true
    ) );

    $wp_admin_bar->add_menu( array(
    ‘id’ => ‘login’,
    ‘title’ => $form,
    ) );

    And boom.

    Fatal error: Call to a member function add_menu() on a non-object in /home/content/p3pnexwpnas05_data03/81/2973181/html/wp-content/themes/jarvis_wp/functions.php on line 624

    I tried removing it and updating but the error screen keeps coming up. Very frustrated and would greatly appreciate any help.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Fatal Error! Need Help.’ is closed to new replies.