Change all wordpress theme options page to same url?

Okay so im running a wordpress multisite installtion, with different themes, and i want to add a new tab to easy blogging which would go to the theme options page for the theme being used. Problem is each theme has a different url, one has "/wp-admin/admin.php?page=am_general" another has "/wp-admin/admin.php?page=website" another has "/wp-admin/admin.php?page=themepanel", how can i change or add somesort of hack/plugin to make each url the same?

  • PC

    Hiya @aphects

    Greetings and thanks for posting on the forums.

    That is certainly gonna be a good level of custom work required to achieve that. While I can not comment on how easy is it to do, you can try posting a Job requirement here : https://premium.wpmudev.org/wpmu-jobs/

    If the theme options for the themes are appearing under the Appearance menu, then you can try and add that menu to the navigation so that it can be accessed via it.

    I have however tagged our lead developer @Vladislav on this post to see if he has got some quick advice about the same.

    Cheers, PC

  • Vladislav

    Hi,

    Although this is certainly possible, perhaps there's an easier way to achieve this - adding a custom Easy Blogging menu entry with the proper theme settings URL, based on the active theme. The basic idea would be to use something like "wp_get_theme" (http://codex.wordpress.org/Function_Reference/wp_get_theme ) to get the currently active theme, then use the Easy Blogging API to add a menu link. This could look a bit like in this generic example: https://premium.wpmudev.org/forums/topic/add-menu-items-to-easy-blogging#post-230384 Alternatively, a similar approach could be used to edit the existing theme settings menu item too. Do you think this approach could work for your scenario?

  • Vladislav

    Hello,

    Of course, here is a working example that will work with our WP Nelo theme - if it's activated on the current site, this example will add a link to its Gallery page (which normally wouldn't be available in Easy mode):

    function wdeb_add_my_site_theme_custom_settings_page ($items) {
    	$theme = wp_get_theme();
    	$directory = !empty($theme->stylesheet) ? $theme->stylesheet : false;
    	switch ($directory) {
    		case "wpmu-nelo":
    			$items[] = array(
    				'check_callback' => false, // Custom callback function for access checking.
    		        'capability' => 'edit_theme_options', // User capability needed to access this page. Can be set to "false".
    		        'url' => 'themes.php?page=gallery.php', // The path to your page
    		        'icon' => WDEB_PLUGIN_THEME_URL . '/assets/icons/theme_icons/edit-themes.png', // Full URL to your icon
    		        'title' => __('Upload Images', 'wdeb'),
    				'help' => __('Upload images here - only jpg, gif and png allowed.', 'wdeb'),
    			);
    			break;
    	}
    	return $items;
    }
    add_filter('wdeb_menu_items', 'wdeb_add_my_site_theme_custom_settings_page');

    For sites that don't have Nelo theme as their current theme, it'll do nothing. As you see from the example, the $items that get passed to "wdeb_menu_items" filter is an array of menu items that will be shown in your Easy Blogging menu. Each menu item is represented as an associative array with several keys: check_callback, capability, url, icon, title and help, The idea here is to check the current theme and create a new menu item that links to that theme's settings page.

    Since the menu items are simply an array, you can also easily remove all the links you wish removed, and/or edit the default ones to better suite your scenario. I hope this can get you started in the right direction.

  • aphects

    @Vladislav I added this code

    function wdeb_add_my_site_theme_custom_settings_page ($items) {
    	$theme = wp_get_theme();
    	$directory = !empty($theme->stylesheet) ? $theme->stylesheet : false;
    	switch ($directory) {
    		case "BasicKloud":
    			$items[] = array(
    				'check_callback' => false, // Custom callback function for access checking.
    		        'capability' => 'edit_theme_options', // User capability needed to access this page. Can be set to "false".
    		        'url' => 'themes.php?page=website.php', // The path to your page
    		        'icon' => WDEB_PLUGIN_THEME_URL . '/assets/icons/theme_icons/edit-themes.png', // Full URL to your icon
    		        'title' => __('Upload Images', 'wdeb'),
    				'help' => __('Upload images here - only jpg, gif and png allowed.', 'wdeb'),
    			);
    			break;
    	}
    	return $items;
    }
    add_filter('wdeb_menu_items', 'wdeb_add_my_site_theme_custom_settings_page');

    To my mu-plugin approach and it does nothing :disappointed:, no new tab added whatsoever, using the theme "BasicKloud". I do also have the <?php opening and closing tags.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.