Half-Elf on Tech

Thoughts From a Professional Lesbian

Tag: mu-plugins

  • Show Site ID Columns in MultiSite

    Show Site ID Columns in MultiSite

    This is totally a use at your own risk sort of thing. I really have no plans to do anything with it, and no, you cannot sort by ID due to limitations in how the columns work in WordPress.

    Installation Instructions
    Make a file called show-site-ids.php, put this code in it, and upload to your mu-plugins folder.

    <?php
    /*
    Plugin Name: Show Site ID
    Plugin URI: https://halfelf.org/hacks/site-id-columns-multisite/
    Description: Show Site ID in Sites Column for Multisite
    Version: 1.0
    Author: Mika 'Ipstenu' Epstein
    Author URI: http://ipstenu.org/
    
            This plugin is free software; you can redistribute it and/or modify
            it under the terms of the GNU General Public License as published by
            the Free Software Foundation; either version 2 of the License, or
            (at your option) any later version.
    
            This plugin is distributed in the hope that it will be useful,
            but WITHOUT ANY WARRANTY; without even the implied warranty of
            MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
            GNU General Public License for more details.
    
    */
    
    function siteid_columns($column, $blog_id) {
            global $wpdb;
            if ( $column == 'site_id' ) {
                    echo $blog_id;
            }
            return $value;
    }
    
    // Add in a column header
    function site_id($columns) {
        $columns&#91;'site_id'&#93; = __('ID', 'site_id');
        return $columns;
    }
    
            add_filter( 'wpmu_blogs_columns', 'site_id' );
            add_action('manage_sites_custom_column',  'siteid_columns', 10, 3);
            add_action('manage_blogs_custom_column',  'siteid_columns', 10, 3);
    ?>
    
  • WordPress Google Libraries

    WordPress Google Libraries

    A lot of people would rather use Google Hosted JavaScript Libraries. Why? Here are three good reasons. Okay, great. How do you do it in WordPress? DigWP has you covered.

    But if you want to do it for WordPress MultiSite, for all sites on your network, you can toss this into your mu-plugins folder. I named my file googlelib.php and dropped it in. Bam.

    Oh and there’s also the Use Google Libraries plugin, by Jason Penney, which works great too. Just drop the use-google-libraries.php file into your mu-plugins folder and call it a day.

    <?php
    /*
    Plugin Name: Google Lib
    Plugin URI: http://digwp.com/2009/06/use-google-hosted-javascript-libraries-still-the-right-way/
    Description: Use Google Hosted JavaScript Libraries (... Still the right way)
    Version: 1.0
    Author: Mika Epstein
    Author URI: http://ipstenu.org/
    */
    
    if( !is_admin()){
       wp_deregister_script('jquery');
       wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"), false, '1.4.4');
       wp_enqueue_script('jquery');
    }
    
    ?>