0

I'm developing Wordpress themes and I'm having an issue with Theme Options on Wordpress Multisite (WPMS). My theme works like a charm on classic Wordpress (WP) installation but when I try to use it with WPMS it returns a blank page instead of a form with theme's settings.

Here what I use to initiate the theme options page:

function setup_theme_admin_menus() {
    add_theme_page( "Theme Options", "Theme Options", "read", "th_op", "th_op" );
    function th_op() {
        get_template_part("content", "options");
    }
}
add_action("admin_menu", "setup_theme_admin_menus");

As I mentioned it works as expected on WP but it refuses to render options page on WPMS.

Yes I am aware of http://wpmututorials.com/known-issues/did-your-users-theme-options-and-widgets-page-disappear/ which is practically everywhere and in fact does not solve the problem in a lot of cases. As you can see I use the lowest capability ever which is "read".

Yes I tried to use theme options as SuperAdmin, JustAdmin and any user type that is possible. Nothing helps.

Please help!

10
  • Do you have a function "th_op" or did you mean "theme_options"?
    – windyjonas
    Aug 22, 2013 at 9:17
  • My bad! I tried to shrink the code a little bit to make it fit the page with no scroll so it will be visible here ... updated!
    – LoomyBear
    Aug 22, 2013 at 9:35
  • I'd strongly advise against nested functions in any PHP code, it's a particularly rank code smell
    – Tom J Nowell
    Aug 22, 2013 at 9:50
  • Thanx for this advise @TomJNowell I will re-nest this function. I'm actually not really good with php. But I don't think it causes this problem ...
    – LoomyBear
    Aug 22, 2013 at 9:53
  • Imagine someone gives you a list of things to do and item number 5 is actually a small parcel containing a whole new list several feet long, what's what PHP feels like when you nest functions, and it never turns out well
    – Tom J Nowell
    Aug 22, 2013 at 10:30

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.