我正在尝试为自定义模板设置我的Wordpress的自定义静态页面。静态页面的自定义模板未显示 - Wordpress
我在wp-content/themes/my_theme
中创建了landingpage.php
,我在选择了LandingPage模型的WordPress管理员中创建了一个新页面。
如果我去my_website.com/landing-page/
我的自定义页面有效,'Hello World!'出现,但如果我将我的自定义页面设置为静态首页并转至my_website.com/
我的'Hello World!'消息不显示。
我landingpage.php
代码:
<?php /* Template Name: LandingPage */ ?>
<?php get_header(); ?>
<div class="wrap">
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php
while (have_posts()) : the_post();
get_template_part('template-parts/page/content', 'page');
if (comments_open() || get_comments_number()) :
comments_template();
endif;
endwhile;
?>
<h1>Hello World!</h1>
</main>
</div>
</div>
<?php get_footer();
任何想法? thx
你的主题文件夹中是否有'front-page.php'文件? – yivi
是的,我有'front-page.php' – Rubyx