• I’m running a WP Network and everything works fine.

    But I want to change some content based on which site a visitor is on.

    For example, in the header of the theme there is an ad. It’s hardcoded in the theme-file. On all sites, it shows the same ad, but I want to be able to change the ad depending on which site you’re on.

    Other example: now it says on my frontpage: top 10 datingsites. On my other site it should say: top 10 diets.

    How do I implement this? I was looking at multilanguage support, but that’s not quite what I’m looking for.

    Now I added some PHP in the theme files that filters based on the URL (<? if (HOME_URL == ‘http://domainA.com&#8217;) { ?>) but I don’t think is the best way to do it, expecially when the number of sites gets bigger.

    Any help is welcome!

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

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Now I added some PHP in the theme files that filters based on the URL (<? if (HOME_URL == ‘http://domainA.com&#8217;) { ?>) but I don’t think is the best way to do it, expecially when the number of sites gets bigger.

    You could do it based on site number, but if everyone’s using the same theme and you hard coded it in, that’s really going to be the only way.

    Thread Starter schwa97

    (@schwa97)

    I found this tutorial:
    http://www.catswhocode.com/blog/how-to-make-a-translatable-wordpress-theme

    I think I can use it for my problem. Create a .po and .mo file for every site and load a language pack depending on the URL using:

    <?
    if (HOME_URL == 'http://domainA.com') {
    load_theme_textdomain( 'domainA', TEMPLATEPATH.'/languages' );
    $language_pack = "domainA";
    }
    ?>

    And then use statments like:
    <?php _e("This text should be translated", $language_pack); ?>

    Would this work?

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Yeah, that should work.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Different content on different sites’ is closed to new replies.