WordPress Multisite Network Footer Plugin

Man sweating as he tries to decided between the shortcode and gutenburg buttons.

We needed to put a data privacy footer link on all our rampages sites.

To do that I added this code in our generic network activated plugin.

Then we realized we’d need to skip that occasionally for particular sites and that’s why we ended up adding a loop to skip sites by ID.

It could be fancier and enqueueI cannot spell this word. scripts etc. rather than just stapling them in but the pattern’s likely to be useful to others wandering in the darkness.

/*------------------------------------PRIVACY FOOTER  ---------------------------------------------------*/
// Make footer element for all rampages sits
function vcu_privacy_function() {
    $avoid = [29429, 29719]; //put any site IDs that you want to skip
    $id = get_current_blog_id();
    if (!in_array($id, $avoid)) {   
        echo '<style>.privacy-policy { display: block; background-color:#fff; margin: 2em 0; padding: 2em; z-index: 1000; overflow: hidden;} .privacy-policy a {color: #424242}</style>';
        echo '<div class="privacy-policy" id="private"><a href="https://rampages.us/privacy-policy/">Privacy Statement</a></div>';
    }
}
add_action( 'wp_footer', 'vcu_privacy_function', 100 );