• Resolved Kerozard

    (@kerozard)


    Hi there!

    I have a small problem that is probably fixed quite easily, but I can’t figure it out.

    I am currently setting up a fresh multisite installation with different paths for the individual blogs. These are going to be localized versions of my site.

    “/”
    => global entry point;
    => just one page that redirects users to a suitable language

    “/en”
    => default (english) language

    “/de”
    => german language

    The challenge is that all three sites do have the same name which is the name of the company. So now I have three identical site names in the MySites list. If I change the blog names to something individual, it will be reflected in numerous places, especially in the site title. I haven’t found an option to add an “internal label”.

    Is there maybe a way to add the path to the site name in the admin “my sites” menu? That would hopefully be enough to prevent any confusion.

    Thanks in advance,

    Patrick

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    In theory…. Make this an MU Plugin:

    <?php
    /*
    Plugin Name: Show Site Path
    Description: Show Site Path in Sites Column for Multisite
    */
    
    function blog_path_columns($column, $blog_path) {
            global $wpdb;
            if ( $column == 'blog_path' ) {
                    echo $blog_path;
            return $value;
    }
    
    // Add in a column header
    function blog_path($columns) {
        $columns['blog_path'] = __('Path', 'blog_path');
        return $columns;
    }
    
            add_filter( 'wpmu_blogs_columns', 'blog_path' );
            add_action('manage_sites_custom_column',  'blog_path_columns', 10, 3);
            add_action('manage_blogs_custom_column',  'blog_path_columns', 10, 3);

    I didn’t test it, but it’s the same idea as this: https://halfelf.org/2011/site-id-columns-multisite/

    Thread Starter Kerozard

    (@kerozard)

    Thank you for your very fast response.

    I tried out your plugin. It is missing a closing } bracket at the end of the if statement. Then it works in that it is adding a new column to the My Sites table displaying the blog number.

    Sadly this is not my what I am trying to achieve. I probably have not made my goal clear enough. My goal is to modify the “My Sites” menu and add the path (“/de/”, “/en/” etc.) to the name in the menu. Following is a mockup of what I’d like the menu to look like. I hope that helps.
    https://i.imgur.com/3HFQuyS.png

    Thread Starter Kerozard

    (@kerozard)

    Okay, I figured it out. The following snippet is all that it takes. But thanks again for your effort. You pointed me in the right direction.

    <?php
    /*
    Plugin Name: Show Site Path
    Description: Show Site Path in My Sites Menu
    */
    
    function modify_my_site_names( $wp_admin_bar ) {
    
        //get "my sites"
        $mysites = $wp_admin_bar->user->{'blogs'};
    
        foreach($mysites as $site) {
          $site->blogname .= ' (' . $site->path . ')';
        }
    }
    
    add_action('admin_bar_menu', 'modify_my_site_names');
    
    ?>
    Thread Starter Kerozard

    (@kerozard)

    *Marking topic as resolved*

    Thread Starter Kerozard

    (@kerozard)

    Mmh, can’t mark a topic as resolved through editing. ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Changing Blog Labels in My Site Menu’ is closed to new replies.