The MU forums have moved to WordPress.org

Run code based on blog (3 posts)

  1. kickoff3pm
    Member
    Posted 13 years ago #

    I have some code I want to run hard coded in a theme. But the code is slightly different for each blog. So I need a bit of php and a function I think - I think it's somethin like this;

    <?php
    switch ($i) {
    case "blog1":
    do this;
    break;
    case "blog2":
    do this;
    break;
    case "blog3":
    do this;
    break;
    }
    ?>

  2. dsader
    Member
    Posted 13 years ago #

    $blog_id is global. But I'd set it up with the following syntax rather than how you've started:

    <?php
    global $blog_id;
    if ($blog_id == 63) {
       echo 'hello fortunate ones';
     }
    if ($blog_id != 63) {
       echo 'hello unfortunate ones';
      }
     ?>
  3. kickoff3pm
    Member
    Posted 13 years ago #

    That would be great but the will be more then just two options, could end up with 100 but just a 5 or 6 to start.

About this Topic

  • Started 13 years ago by kickoff3pm
  • Latest reply from kickoff3pm