Viewing 6 replies - 1 through 6 (of 6 total)
  • Using “GET” variables might be a slick way to go. Any time you see something like “?x=y” in the site’s url, it’s able to pass information to the site that you can then use for different things.

    In your index file, try writing something like this:

    <?php if($_GET['site'] == 1) { ?>
    
    Hey, welcome to site 1!
    
    <?php } else if ($_GET['site'] == 2) { ?>
    
    Hey, welcome to site 2!
    
    <?php } else { ?>
    
    <a href="http://www.yoursiteaddress.com?site=1">Go to site 1</a>
    <a href="http://www.yoursiteaddress.com?site=2">Go to site 2</a>
    
    <?php }; ?>

    Basically that tells the browser that if the address contains ?site=1 to say “Hey, welcome to site 1”, if it contains ?site=2, say “Hey, welcome to site 2”, and otherwise to give links to the 2 different sites.

    There’s plenty of different ways to do it, but the benefit is that you can manage all three of the different home pages within your index page.

    Thread Starter ttopel06

    (@ttopel06)

    Thank you very much. I will have to see if I can figure this out.

    Thread Starter ttopel06

    (@ttopel06)

    One more question: Is there a specific place I should copy and paste this code?

    The content above will go in your theme’s main index file. So from your dashboard, go to ‘appearance’ on the left side, and then ‘editor’. Then over on the right side, where all your theme files are listed, click ‘Main Index Template’.

    If you replace everything inside the Main Index Template with the code I provided, it will work. But, it’s going to appear very bare bones because it won’t include your theme’s header, footer, or sidebar (if your theme uses one). So if you want to keep those things, the page will look like:

    <?php get_header(); ?>
    <?php get_sidebar(); ?>
    <?php if($_GET['site'] == 1) { ?>
    
    Hey, welcome to site 1!
    
    <?php } else if ($_GET['site'] == 2) { ?>
    
    Hey, welcome to site 2!
    
    <?php } else { ?>
    
    <a href="http://www.yoursiteaddress.com?site=1">Go to site 1</a>
    <a href="http://www.yoursiteaddress.com?site=2">Go to site 2</a>
    
    <?php }; ?>
    <?php get_footer(); ?>
    Thread Starter ttopel06

    (@ttopel06)

    I see what you did. It works. I just have to add my images now.

    Thread Starter ttopel06

    (@ttopel06)

    Thank you very much

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Index page How to’ is closed to new replies.