• I have a site where I would like to “inter change” the main page. I do not want the main page and then a sub-page or folder, I want to replace the page and I need to be able to keep the original page because I will need to do an A/B Test.

    How can I achieve this?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Rename the index.php to something else. Then edit the file and at the top add, <?php /* Template name: A */ ?>.

    Then create a new PHP file, add the content you want to be on the homepage. Add <?php /* Template name: B */ ?> to teh top.

    Now, in your WordPress Dashboard, add a new page, add a title, NO CONTENT, and to the right, use the drop down box to select the A template. Add the page.

    Again, add a new page, add a title, NO CONTENT, and to the right, use the drop down box to select the B template. Add the page.

    Thread Starter cdcolo

    (@cdcolo)

    Thanks for this information. I hope this is not too much to ask but, I’ve got a couple of more questions on same topic.

    1) when I rename index.php to something else, do I want to keep a file named index.php (as it is) with it’s current contents?

    2) When you say create a new PHP file, “adding the content…” am I “really” adding content or making this file to look the same as the one in step 1 above or am I actually dumping in code, video and the content of what the page will look like?

    3) I’m thinking this code will allow me to have a drop-down menu to select Template A or Template B and make that the page which people will see when they access my primary URL.

    Thread Starter cdcolo

    (@cdcolo)

    OK, this is what I have done thus far.

    1) took the index.php file and renamed it to indexa.php

    2) took indexa.php and added <?php /*Template name: A /*?> to the 1st line.

    3 created a file called indexb.php and added <?php /*Template name: B /*?>

    4) went to WP and began to create a PAGE called NO CONTENT (didn’t save) but, looked in the Page Attributes PARENT drop-down box for Template A & B. Couldn’t find these files.

    So between my previous message above and the info herein, hopefully we should be able to point out where I went wrong.

    Also of note: I’m using a Theme called Optimized Press which has several different templates already installed if, this is where I’m to find the newly created templates.

    Again, thanks for all your help.

    The PHP code is setup incorrectly.

    <?php
    /*
    Template name: A
    */
    ?>

    — Andrew

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

The topic ‘Replacing Main Page’ is closed to new replies.