【问题标题】:Use a different page template for wordpress e-commerce为 wordpress 电子商务使用不同的页面模板
【发布时间】:2012-11-12 03:26:26
【问题描述】:

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

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

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

谢谢!

【问题讨论】:

    标签: php wordpress wordpress-theming


    【解决方案1】:

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

    <?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  } ?>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-01-01
      • 1970-01-01
      • 2012-08-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-23
      • 2018-10-21
      相关资源
      最近更新 更多