WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] WordPress Admin Bar is not working with my custom theme? (33 posts)

  1. CoasterMedia
    Member
    Posted 3 years ago #

    Background:
    I'm developing my own theme for one website that is operating on WordPress Network (WordPress Mu) and I had no problem with the past upgrades. After upgrading to WordPress 3.1 and using the Network Admin. I wasn't able to access to the Network Admin with my custom theme. However, when I switch the theme back to Twenty Ten, it works fine? What should I do?

    Error

    Fatal error: Call to undefined function add_contextual_help() in XXXXXXXXXXXXXXXX/wp-admin/network/settings.php on line 22

    Code

    $title = __( 'Settings' );
    $parent_file = 'settings.php';
    
    // Line 22 start here
    add_contextual_help($current_screen,
    	'<p>' . __('This screen sets and changes options for the network as a whole. The first site is the main site in the network and network options are pulled from that original site’s options.') . '</p>' .
    	'<p>' . __('Operational settings has fields for the network’s name and admin email.') . '</p>' .
    	'<p>' . __('Dashboard Site is an option to give a site to users who do not have a site on the system. Their default role is Subscriber, but that default can be changed. The Admin Notice Feed can provide a notice on all dashboards of the latest post via RSS or Atom, or provide no such notice if left blank.') . '</p>' .
    	'<p>' . __('Registration settings can disable/enable public signups. If you let others sign up for a site, install spam plugins. Spaces, not commas, should separate names banned as sites for this network.') . '</p>' .
    	'<p>' . __('New site settings are defaults applied when a new site is created in the network. These include welcome email for when a new site or user account is registered, and what᾿s put in the first post, page, comment, comment author, and comment URL.') . '</p>' .
    	'<p>' . __('Upload settings control the size of the uploaded files and the amount of available upload space for each site. You can change the default value for specific sites when you edit a particular site. Allowed file types are also listed (space separated only).') . '</p>' .
    	'<p>' . __('Checkboxes for media upload buttons set which are shown in the visual editor. If unchecked, a generic upload button is still visible; other media types can still be uploaded if on the allowed file types list.') . '</p>' .
    	'<p>' . __('Menu setting enables/disables the plugin menus from appearing for non super admins, so that only super admins, not site admins, have access to activate plugins.') . '</p>' .
    	'<p>' . __('Super admins can no longer be added on the Options screen. You must now go to the list of existing users on Super Admin > Users and click on Username or the Edit action link below that name. This goes to an Edit User page where you can check a box to grant super admin privileges.') . '</p>' .
    	'<p><strong>' . __('For more information:') . '</strong></p>' .
    	'<p>' . __('<a href="http://codex.wordpress.org/Network_Admin_Settings_Screen" target="_blank">Documentation on Network Settings</a>') . '</p>' .
    	'<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
    );

    I do have "setting.php" in my theme folder as part of the theme options.

    Any help would be great! Thank you in advance.

  2. CoasterMedia
    Member
    Posted 3 years ago #

    Update:
    I just move all the scripts from setting.php in my theme folder and move it over to functions.php. That took away the fatal error away.

    Now I can't see the WP Admin bar when I'm viewing my site. Any suggestion? All I see is a black gaps. I can see it from the admin site but not when I'm viewing my site as part of the 3.1 new feature.

    Thanks in advance.

  3. aoddy
    Member
    Posted 3 years ago #

    Yessss, I have got like this problem alsoooo...

    Please help us !!!

    Thanks,

  4. ferasof
    Member
    Posted 3 years ago #

    I have got like this problem tooo...

    Please help us !!!

    Thanks,

  5. I can't see any reason why that would bork anything....

    Can anyone post *any* kind of details or even a link to their site?

  6. ferasof
    Member
    Posted 3 years ago #

    this is my site
    http://sham-soft.com

    plugin in used
    FireStats 1.6.7-stable

    that is all

  7. eceleste
    Member
    Posted 3 years ago #

    This may be too obvious, but I found that I'd failed to call wp_footer() just before the closing body tag in some of my themes. Once I put that in place, the admin bar appeared.

  8. Yep.

    Check your theme's footer.php file. Does it have a call to wp_footer() ?

    If not, stuff it in there.

  9. ferasof
    Member
    Posted 3 years ago #

    Andrea_r
    my problem not in the admin bar. it is in admin area
    i can't login in to Network Admin link.

    the following message is appear
    ==============================
    Fatal error: Call to undefined function add_contextual_help() in /home/xxxxxxx/public_html/wp-admin/network/settings.php on line 22
    ==============================

    what is the problem ?

  10. Disable your plugins by renaming the plugins folder via ftp.

    then go to http://sham-soft.com/wp-admin/network/

    if you still can;t get in, LOOK at the files on the server/ Go to the wp-admin/network folder. Are there actual files there?

  11. Samuel Wood (Otto)
    Tech Ninja
    Posted 3 years ago #

    "Call to undefined function" always means the same thing: incomplete upgrade.

    Do a Manual Upgrade instead:
    http://codex.wordpress.org/Updating_WordPress#Manual_Update

  12. ferasof
    Member
    Posted 3 years ago #

    Andrea_r & Otto

    i have disabled all plugins and uploaded a fresh wordpress copy but the problem is still

    any idea?

  13. aoddy
    Member
    Posted 3 years ago #

    Hi Ferasof,
    Right now, I downgrade my site to wordpress-3.0.5...

    http://wordpress.org/wordpress-3.0.5.zip

    First, I upload upload directory "wp-admin" & "wp-include"..

    Don't forget to backup your both directories first..

    Second, I upload my old "wp-settings.php" it is a file that I backuped before I upgrade to wordpress-3.1.

    So.. Good luck ^_^

  14. Yeah, don't do that.

    The DATABASE was upgrade, and is kinda not so much compatible with 3.0.5 so you will have issues down the line. Don't downgrade, please. You'll get hurt.

    Did you try using the default theme?

  15. aoddy
    Member
    Posted 3 years ago #

    My site was downgraded already..
    Everything is OK..

    For my site, the multi-site is very importance .. I cannot wait ..

    So.. whatever do you want to do.. Backup first!!

    .. ei ei .. ^_^

  16. aoddy - Just be aware, if things get really broken later, this will probably be why. It's NOT something I recommend people do off the major releases.

    Yes, always backup first :)

  17. eceleste
    Member
    Posted 3 years ago #

    Just to be clear: if I ...

    1. backed up my db before the update.
    2. then was hosed by a major update.
    3. then rolled back the db to my backup and restored the old version.

    ... I should be OK, right?

    Your concern is about rolling back the version without removing the db changes made by the update. That does seem like it could be a problem.

  18. eceleste - Yes, that's fine :) And yes, that IS what concerns me.

  19. ferasof
    Member
    Posted 3 years ago #

    the problem has been solved when i used the default theme .
    it means that the problem is into the theme.

    thanks for all for your help

  20. what theme was it?

  21. ferasof
    Member
    Posted 3 years ago #

    Template that contains the problem, Designed by myself.
    I think that there is something wrong in the file functions.php

  22. praeix
    Member
    Posted 3 years ago #

    Had the same issue with my admin bar not showing when viewing the site. I developed a custom theme, but forgot to include the wp_footer() function. Once I put that in there, it displays perfectly.

    To elaborate a bit as to why it happened, the wp_head() function sets the admin bar to display: none in your CSS at the top. Mine was a blank white space where the admin bar should've been (yours will be whatever background color you've set for your site). The wp_footer() call actually builds the bar and includes the proper JS file that will show it via CSS. So, lesson learned the hard way, always make sure to include wp_footer() :-)

    Thank you for the solution!

  23. cialtronale
    Member
    Posted 3 years ago #

    For me the problem is in function.php file of gemer theme:
    include("settings.php");

    This call the wp settings.php general file instead of the theme's settings.php file.
    I rename settings.php in theme to theme_settings.php and change the line above in :

    include("theme_settings.php");

    Thank you ferasof for the function.php hint

  24. CoasterMedia
    Member
    Posted 3 years ago #

    @ferasof Thanks. I got it resolved. Just now need to work on making Admin Bar visible with my custom theme. I just see a gap where the admin bar was suppose to appear. I just disable it from the dashboard until I figure it out.

  25. Rastatopoulos
    Member
    Posted 3 years ago #

    Don't forget to had the "wp_footer();" anchor in your footer.php. this is needed to include files for display the admin bar.

  26. CoasterMedia
    Member
    Posted 3 years ago #

    I just tried that and no luck. Mmmm.

  27. CoasterMedia
    Member
    Posted 3 years ago #

    I got it! Yay! My clients will be thrilled now. Time to update all of the clients website that use WordPress and contact all of them to explain the good news. :)

  28. AlexPetrie
    Member
    Posted 3 years ago #

    My Thanks to both eceleste and Andrea_r

    I had created my first custom theme (based on WP 2010) and had tried stripping code out bit by bit with no effect. Of course that's because it wasn't that my code had something WP didn't like, it was missing wp_footer()

  29. metoo55
    Member
    Posted 2 years ago #

    Thanks for ferasof,

    I found this problem too. I use theme "Schemertype Mag" then after i change theme to default (twenty ten) everything ok.

    Just confirm, setting.php in line 22 come from Theme.

    Regards,
    metoo55

  30. jc786
    Member
    Posted 2 years ago #

    Hi
    I made the albizia theme the default theme and am getting the samee error message. I want to change it back to the default theme but i cant get access to the network admin because of the error message.

    How can i get into the network admin to change the default theme?
    Thnaks

Topic Closed

This topic has been closed to new replies.

About this Topic