How to create a duplicate home page in Wordpress (Genesis child theme)

Nick picture Nick · Jun 11, 2014 · Viewed 8.4k times · Source

I want to create duplicates of my home page so I can do split testing with Google Analytics. I created a custom page template by copying and pasting front-page.php into a new php file. The new template shows up, but when I create a page using the new template, the blog portion of the page is missing.

Here is my home page: http://teamrcia.com

Here is the duplicate: http://www.teamrcia.com/homepage2/

The php code for the duplicate is below. Can anyone help me see what I'm missing? Thanks very much.

Nick Wagner

<?php

/*
 * Template Name: Home Page 2
 */
/**
 * This file adds the Home Page to the Streamline Pro Theme.
 *
 * @author StudioPress
 * @package Streamline Pro
 * @subpackage Customizations
 */

add_action( 'genesis_meta', 'streamline_home_genesis_meta' );
/**
 * Add widget support for homepage. If no widgets active, display the default loop.
 *
 */
function streamline_home_genesis_meta() {

    if ( is_active_sidebar( 'home-featured-1' ) || is_active_sidebar( 'home-featured-2' ) || is_active_sidebar( 'home-featured-3' ) ) {

    //* Force content-sidebar layout setting
    add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_content_sidebar' );

    // Add streamline-pro-home body class
    add_filter( 'body_class', 'streamline_body_class' );

    // Add homepage widgets
    add_action( 'genesis_before_content_sidebar_wrap', 'streamline_homepage_widgets' );

    }
}

function streamline_body_class( $classes ) {

    $classes[] = 'streamline-pro-home';
    return $classes;

}

function streamline_homepage_widgets() {

    if ( is_active_sidebar( 'home-featured-1' ) || is_active_sidebar( 'home-featured-2' ) || is_active_sidebar( 'home-featured-3' ) ) {

    echo '<div class="home-featured">';

    genesis_widget_area( 'home-featured-1', array(
        'before' => '<div class="home-featured-1 widget-area">',
        'after'  => '</div>',
    ) );

    genesis_widget_area( 'home-featured-2', array(
        'before' => '<div class="home-featured-2 widget-area">',
        'after'  => '</div>',
    ) );

    genesis_widget_area( 'home-featured-3', array(
        'before' => '<div class="home-featured-3 widget-area">',
        'after'  => '</div>',
    ) );

    echo '</div><!-- end #home-featured -->';   

    }

}

genesis();  

Answer

Dan picture Dan · Feb 10, 2015
  1. Inside your Wordpress Dashboard, go to Appearance > Editor and choose the Template that your Home Page is using (most probably home.php)
  2. Copy the contents into a text file and name it whatever you like (say new_template.php) and add a Template Name on top of the code.
  3. Upload this PHP file to the wp-content/themes/your-chosen-theme/ folder using FTP.
  4. Back in your Dashboard, go to Pages > Add New. On the right panel, choose the New Template you've added.
  5. Publish and view the page. It should resemble your Home page.