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 ?

3 Answers
3

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(){
    global $pagenow;
    if( 'site-info.php' == $pagenow ) {
        ?><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.

Leave a Reply

Your email address will not be published. Required fields are marked *