Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I want to add meta fields for the sites in my network (such as a thumbnail and a category). I know how to do this using get/add/update_site_option, but I'm wondering where I could put the UI to manage those meta fields.

The best place would be in the Sites > Infos page, just after the site attributes, but I can't find any hook to hang on. I can add those fields in the "Settings" tab of the same screen, but one has to scroll down a lot to find it, and it gets mixed with advanced settings.

Any suggestion ?

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

I finally found a way to add more lines to the Sites > Infos table : My own option in the Sites > Infos table

It's a little bit ugly, but it works. I simply use the action admin_footer to add a bunch of HTML code at the end of the page, and then use jQuery to move it to the right place.

add_action('admin_footer', 'user16975_custom_options');
function user16975_custom_options(){
    if(strpos($_SERVER['PHP_SELF'], 'wp-admin/network/site-info.php') !== false) {
        ?><table><tr id="user16975_custom_options">
            <th scope="row">My own option</th>
            <td><input type="text"/></td>
        </tr></table>
        <script>jQuery(function($){
            $('.form-table tbody').append($('#user16975_custom_options'));
        });</script><?php
    }
}

The good part is that as soon as the hook will be available, I can use it without big changes in my code.

share|improve this answer
1  
It's simpler with global $pagenow; if( 'site-info.php' == $pagenow ) {}. . . . For the records, I just saw that Multilingual Press creates a new tab in that screen. –  brasofilo Jul 5 '13 at 22:04
    
Thanks for the $pagenow tip @brasofilo, it's cleaner. –  Fabien Quatravaux Jul 7 '13 at 20:27
    
Multilingual Press is using the manage_sites_custom_column action to add a column to the sites table in sites.php page. I want to add a tab in the site-info.php page, where you can change the informations linked to one of the sites. –  Fabien Quatravaux Jul 7 '13 at 20:29
    
MLP has a tab in site-info.php, but I just checked and is injected with jQuery as well :/ –  brasofilo Jul 10 '13 at 20:47
    
How would you save the data along with the other fields on submit? –  chris Mar 10 at 23:33
add comment

The Site Info admin page's code is here: http://core.trac.wordpress.org/browser/trunk/wp-admin/network/site-info.php

Unfortunately, there don't appear to be any hooks or filters in the site-info.php code.

It looks like you'll have to make your own administrative page -- perhaps in the wp-admin Settings menu -- to handle your {$verb}_site_option code.

share|improve this answer
    
I want to have my options UI in the multisite administration zone, (wp-admin/network/...), not in each individual site dashboard. For example, that would be great to have the possibility to add a tab in the Sites > Infos page. –  Fabien Quatravaux Jun 21 '13 at 13:40
    
This might be what you're looking for then -- wordpress.stackexchange.com/questions/16474/… -- from the Related links on the right. –  Pat J Jun 21 '13 at 13:45
    
Nope. The post you are linking is talking about the Settings main menu in the Network admin dashbord (wp-admin/network/settings). I'm talking about the page where you can modify individual site options in the Site main menu (wp-admin/network/site-info.php?id=X). –  Fabien Quatravaux Jun 23 '13 at 20:46
    
You might be out of luck, then. –  Pat J Jun 23 '13 at 22:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.