• Ok, I’m going to try this and wonder if I can get some feed back about if it will work. I don’t think it will! (It’s a live site, otherwise I’d tinker away).

    Here’s the contents of the network’s Parent Child’s footer.php

    <div class="footer">
        <div class="container_12">
            <?php tfuse_footer(); ?>
            <div class="clear"></div>
            <div class="copyright"><?php echo tfuse_options('custom_copyright'); ?></div>
        </div>
    </div>
    <?php wp_footer(); ?>
    </body>
    </html>

    I want to use the footer contents of Blog ID 1 for the footer of the entire network. I’m thinking this?

    <?php
    
    /* We have to start our php with an opening statement.
    If we really want to be fancy we can add some things here in the comments to tell everyone what this does. */
    
    /*
    Plugin Name: Snazzy
    Description: Adds some snazzy to all the footer
    Author: Ms. Snazzy
    Version: 1.0
    Author URI: www.snazzy.com
    */
    
    function snazzy_footer () { ?>
    
    /* see what we did there? We declared a function then closed our php again. Why? So we can add whatever html goodies we like. */
    
    <div class="footer">
        <div class="container_12">
            <?php tfuse_footer(); ?>
            <div class="clear"></div>
            <div class="copyright"><?php echo tfuse_options('custom_copyright'); ?></div>
        </div>
    </div>
    <?php wp_footer(); ?>
    </body>
    </html>
    
    /* Now every blog on our system will get this sentence inserted into the footer of whatever theme they used. And we did not have to edit every single theme. I know you picked something like 250 right? */
    
    <?php }
    
    /* We opened up our php again. we have to tell WPMU something important. */
    add_action('wp_footer', snazzy_footer');
    
    /* Ta da! This is the magic line folks. Let's close up shop now. */
    ?>

    Would that just create two footers of the same thing on each site? Some sort of footer within a footer within a footer that I’ll never get out of?

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

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    That would be BAD. You’re calling wp_footer in wp_footer. Yikes!

    You’d want to edit the child theme and put in switch_to_blog()

    http://wpmututorials.com/plugins/add-a-global-menu-to-your-network/ is a rather extreme example.

    I do have a constant footer on all my themes, but I can’t see a work around for editing every single theme’s footer.php.

    The css/container class/id names in each theme varies widely. Further, hooking wp_footer(), if it exists, can place your intended footer in odd places. The trial and error time alone is likely same/less than manually editing each footer.php anyway.

    Editing each theme was tedious at first, (300+) but the trial and error getting the footer to look just right in each theme meant I had to punt certain themes for poor coding standards (also trimming down the code I needed to insert into each theme)

    I keep a my_footer.php in mu-plugins then stick its my_footer() function into a newly installed or updated theme and away I go. Takes more time to update to newly released updates, but in Multisite – taking one’s time before hitting the update button has it’s advantages.

    Thread Starter Angie Meeker

    (@ameeker)

    Using this thread for my notes now. I don’t have it working yet, but these other threads might help me get there.

    http://wordpress.org/support/topic/sub-blogs-use-the-main-blog-widgets?replies=21

    Thread Starter Angie Meeker

    (@ameeker)

    <?php
        global $switched;
        switch_to_blog(7);
        echo 'You switched from blog ' . $switched . ' to 7';
        restore_current_blog();
        echo 'You switched back.';
    ?>

    This is the switch to blog documentation from the Codex.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Hook into footer for purpose of one global footer’ is closed to new replies.