0

我希望能够在与普通 index.php 页面不同的页面模板中显示 wordpress 插件的页面:'wp e-commerce'。

购物车的示例 URL 是:products-page/checkout/

但是,它只是将该内容放入 index.php 模板中。有没有办法创建不同的页面模板或 if/else 语句,根据用户所在的电子商务页面进行更改,例如原生 wordpress 层次结构的工作方式?

谢谢!

4

1 回答 1

0

我发现您可以使用条件语句定位页面标题,然后将页面标题用于结帐页面并创建以下内容:

<?php
if (is_page( 'Checkout' ) ) {
    if ( have_posts() ) : while ( have_posts() ) : the_post();
        the_content();
        endwhile; else: ?>
    <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
<?php }   
else{ ?>
    <!--Normal Page Content-->
<?php  } ?>
于 2012-11-23T19:28:03.853 回答