0
我正在将前端网站加载到html5blank wordpress主题上。 header.php和footer.php文件工作正常,但我的第一个get_template_part()部分不会显示。我浏览了模板层次结构,看不到可能导致问题的原因。Wordpress - get_template_part()部分未显示
这是我有我的代码 -
whatwedo.php
<?php /* Template Name: whatwedo */ ?>
<section id="what">
<!-- whatwedo template code -->
</section>
的index.php
<?php get_header(); ?>
<!-- section -->
<section>
<?php get_template_part('whatwedo'); ?>
</section>
<!-- /section -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
页面home.php
<?php get_header(); ?>
<?php get_template_part('whatwedo'); ?>
<?php the_content(); ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
我不确定模板名称是否应该在index.php或page-home.php中,但不管它应该显示出来吗?到目前为止,我只在仪表板中设置了两个页面 - 家庭和博客 - 而且我很确定它们设置正确。
任何人都可以看到为什么这可能会发生?
只要模板文件whatwedo.php在子或父主题中,那么它应该找到它。我看不出您的代码有任何问题... –
@AndrewSchultz这太令人沮丧了。没有模板显示 - 它看起来像在那里,但我看不到它们。就像我有一个隐藏一切的默认不透明规则。 –
你可以检查浏览器源代码,看看模板是否存在但被CSS规则隐藏了吗? –