Multisite – Display different header content based on which site is accessed

You can use options to customize this for every site. Options are stored separately for each site.

So, inside your header you can do something like


<?php
$login_link = get_option("worduoso_login_link");
$login_text = get_option("worduoso_login_text");
?>

and then print it like this

<?php if($login_link && $login_text): ?>
<div class="added-header"><a href="https://wordpress.stackexchange.com/questions/273810/<?php echo $login_link; ?>"><?php echo $login_text; ?></a></div><?php endif; ?>

So, how do you set this option?

If you want to add it just once you can just execute this code:


<?php
add_option( 'worduoso_login_link', 'http://www.example.com/login', '', 'yes' );
add_option( 'worduoso_login_text', 'Customer Login', '', 'yes' );
?>

(add code to functions.php and call the correct site, repeat for each site)

Better way is to add a section to theme customizer where those will be shown to admin under Appearance->Customize in WP admin. This is a bit more advanced code, here is the gist with 2 pieces – once to include in functions.php and one to include in header.php: https://gist.github.com/worduoso/9439aee7c5b91380527a06ac17498d41

tech