WordPress.org

Ready to get started?Download WordPress

Forums

How do I add custom theme files to a network site? (4 posts)

  1. Michelle Langston
    Theme Wrangler at Automattic
    Posted 3 years ago #

    I have a theme installed on my multisite network that uses Child Themes to make changes. I want to create my own version of a file on one of the sites in my network (let's call it Site #2) and add it to the Child Theme in use on Site 2. For example, I want to create a custom "comments.php" in the Child Theme for Site #2.

    However, since Site #2 is "virtual", it does not not have an actual folder on the server. So is it impossible to create a custom template file for that site?

  2. David Sader
    Member
    Posted 3 years ago #

    global $blog_id;
    if( $blog_id == '2' ) {
    //do some comment stuff for blog 2
    }
  3. Michelle Langston
    Theme Wrangler at Automattic
    Posted 3 years ago #

    Hi, thanks for the reply and sorry it took so long for me to respond, got sidetracked in a major way, lol! So would I put that code in functions.php? What if the owner of Site 2 was a client? Where would he/she put that code?

  4. You'd put it in your comments.php.

    global $blog_id;
    if( $blog_id == '2' ) {
    // do some comment stuff for blog 2
    }
    else {
    // The rest of your normal comments.php stuff
    }

    Option 2 would be to make a second child theme JUST for Site 2. Depends on what kind of changes you're talking about though.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.