0

在 WordPress 中,我一直在安装和使用各种主题,包括 2013、Roots 和现在的 BlankSlate。我注意到现在我已经激活了 BlankSlate,get_template_directory()front-page.php 中使用的函数仍在返回 Roots 主题目录的路径。我当前的 front-page.php 看起来像这样。

<?php get_header(); ?>
<section id="content" role="main">
       <img class="frontpageimg" src="<?php get_template_directory(); ?>/images/slogan-2.png">


       <h4>In the Los Angeles area? </h4> <p>Ask about free demo loaners! </p>
       <h4>We also take mail orders.</h4> On all orders, there is a 30-day return policy!</p> 



       <img src = "<?php get_template_directory(); ?>/assets/img/cables-ers-absorber-700.jpg"/></a>
       <img src = "<?php get_template_directory(); ?>/assets/img/blueprint-silencers-v2-700.jpg"/></a>
       <img src = "<?php get_template_directory(); ?>/assets/img/brav-front-page-700.jpg"/></a>

        <a href="contact" class="btn btn-lg btn-orange">Contact Us</a>

</section>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
4

2 回答 2

1

利用:

<?php bloginfo('template_directory'); ?>

代替:

<?php get_template_directory(); ?>

于 2013-10-24T11:16:35.023 回答
0

首先

  1. 您可以检查两个主题名称是否不同
  2. 转到当前主题、索引页面并更改模板名称
于 2013-10-24T07:11:49.963 回答