WordPress.org

Forums

[resolved] use one header.php for multi site (2 posts)

  1. strandcreative
    Member
    Posted 1 year ago #

    Hi,

    We have a WordPress installation in the root directory.
    We are then having another 5 WordPress installs in different directories on the server so we can have different branches managing different content with separate logins.

    If we make changes to the header.php on the main site in the root, we woiuld like this to update on all the other 5 installs via an include file function. I've tried to use the include function to bring in the header.php from the URL but it doesn't work. Can you use a specific URL in the include function?

    <?php
    include('http://www.domain.com/wp-content/themes/themename/header.php');
    ?>

    Is there an easier method that I'm missing where we can get those changes to update on all the other installs via one header.php template?

  2. LeRedac
    Member
    Posted 3 months ago #

    include (TEMPLATEPATH . '/header.php');

    or if you whant one header per blog use something like this :

    <?php
    // Exenple whith :
    // ID Web name Site 1 = 1 << First Blog (principal)
    // ID Web name Site 2 = 2
    // ID Web name Site 3 = 3
    // ID Web name Site 4 = 4
    // Get current Blog ID
    $blog_id = get_current_blog_id();
    // Get Theme directory url
    $theme_url=get_template_directory_uri();
    // Make conditions
    if     ($blog_id =="2"){include (TEMPLATEPATH . '/header2.php');}
    elseif ($blog_id =="3"){include (TEMPLATEPATH . '/header3.php');}
    elseif ($blog_id =="4"){include (TEMPLATEPATH . '/header4.php');}
    else { include (TEMPLATEPATH . '/header.php');} // Else = ID 1 - First Blog
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic