首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在Wordpress (创世纪子主题)中创建一个重复的主页

如何在Wordpress (创世纪子主题)中创建一个重复的主页
EN

Stack Overflow用户
提问于 2014-06-11 18:53:35
回答 1查看 9.1K关注 0票数 1

我想要创建我的主页副本,以便我可以做分裂测试与谷歌分析。我创建了一个自定义的页面模板,方法是将front-page.php复制并粘贴到新的php文件中。新模板将显示出来,但是当我使用新模板创建页面时,页面的博客部分就会丢失。

这是我的主页:http://teamrcia.com

下面是副本:http://www.teamrcia.com/homepage2/

复制的php代码如下所示。有人能帮我看看我错过了什么吗?非常感谢。

尼克·瓦格纳

代码语言:javascript
复制
<?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();  
EN

回答 1

Stack Overflow用户

发布于 2015-02-10 06:56:11

  1. 在Wordpress仪表板中,转到外观>编辑器,并选择主页使用的模板(很可能是home.php)
  2. 将内容复制到文本文件中,并将其命名为您喜欢的任何名称(比如new_template.php),并在代码的顶部添加一个模板名。
  3. 使用FTP将这个PHP文件上传到wp内容/主题/您选择的主题/文件夹中。
  4. 回到您的仪表板上,转到Pages > Add。在右侧面板上,选择添加的新模板。
  5. 发布并查看页面。它应该像你的主页。
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24170455

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档