首页 文章

删除Roots WP主题中的补充工具栏Woo Commerce

提问于
浏览
0

我正在使用Roots WP主题 . 无论如何我也安装了Woo Commerce,我试图让它配置为不在所有Woo Commerce页面上显示任何侧边栏 .

我已经完成了整个教程两次:http://roots.io/using-woocommerce-with-roots/

它没有解决如何删除Roots / WooCommerce的侧边栏,如何删除重复的页眉,页脚和侧边栏 . 校验!我已经完成了;现在我只想一起删除侧边栏 .

我已将archive-product.php,single-product.php页面添加到Roots主题中并插入以下代码行:

<?php woocommerce_content(); ?>

我编辑了lib / config.php文件,但没有在某些主题上显示侧栏 .

array(
        'template-custom.php',
        'template-page.php',
        'template-shop.php',
        'archive-product.php',
        'single-product.php'
    )

徒劳无功!

我做了一切我可能想到的去除侧栏 . 有人有什么建议吗?

谢谢!

1 回答

  • 1

    您可以将WooCommerce conditionals中的任何一个添加到 /lib/config.php 的侧边栏配置中的第一个数组 .

    我首先添加 is_woocommerce 以从所有WooCommerce页面中删除侧边栏 .

    Example:

    function roots_display_sidebar() {
      $sidebar_config = new Roots_Sidebar(
        /**
         * Conditional tag checks (http://codex.wordpress.org/Conditional_Tags)
         * Any of these conditional tags that return true won't show the sidebar
         *
         * To use a function that accepts arguments, use the following format:
         *
         * array('function_name', array('arg1', 'arg2'))
         *
         * The second element must be an array even if there's only 1 argument.
         */
        array(
          'is_404',
          'is_front_page',
          'is_woocommerce' // New Conditional for WooCommerce Pages
        ),
        /**
         * Page template checks (via is_page_template())
         * Any of these page templates that return true won't show the sidebar
         */
        array(
          'template-custom.php'
        )
      );
    

相关问题