• I have a network setup with various sites (1 per city), and I am wanting to have the local phone number show up on each one depending on the city. I am learning php, but am not there quite yet. I am thinking something like

    if $page = ("city 1") {
    print "817-000-0000")
    }elseif ("city 2"){
    }

    or something like that. I know, I know, lousy php, I am learning. I thought maybe using custom fields, but I really think it is simpler than this. Any thoughts? Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Is there a domain per city? If so I use something like

    if
    ($_SERVER[‘HTTP_HOST’]==’citya.com’)
    {echo 223-4567;}
    elseif
    ($_SERVER[‘HTTP_HOST’]==’cityb.com’)
    {echo 987-6543;}
    else
    ($_SERVER[‘HTTP_HOST’]==’cityc.com’)
    {echo 666-7777;}

    Add all the elseif lines you need

    Thread Starter webmaster in texas

    (@webmaster-in-texas)

    Thank you SO much!

    careful, I forgot the quotes on the numbers

    What multi domain module do you use? Is it WP 3.X compatible?

    Thread Starter webmaster in texas

    (@webmaster-in-texas)

    not a module, it is the wordpress 3.0 networking feature in all its glory. I am trying to master the geolocation bit, as this is perfect for companies who want to showcase sites for every location they are in. A little php and some variables, and I know I can pull it off.
    Thanks everyone.

    Thread Starter webmaster in texas

    (@webmaster-in-texas)

    Hey, I am getting an error-
    Parse error: syntax error, unexpected ‘{‘ in /home/”’/public_html/wp-content/themes/”’/header.php on line 82

    This is the php I put into the header file:
    [Code moderated as per the Forum Rules. Please use the pastebin]

    Thread Starter webmaster in texas

    (@webmaster-in-texas)

    FYI I finally got it:

    <?php
    if
    ($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] =="autohelpalliance.com/dallas/")
    print ("214-838-5101");
    elseif
    ($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']== "autohelpalliance.com/houston/")
    print ("832-431-4305");
    elseif
    ($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] =="autohelpalliance.com/fortworth/")
    print ("817-900-8433");
    elseif
    ($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] =="autohelpalliance.com/san-antonio/")
    print ("210-209-8712");
    else
    print ("not yet");
    ?>

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Want to add php to echo different phone num. per site on multi-sites’ is closed to new replies.