【问题标题】:Add custom tab in admin woocommerce product在管理 woocommerce 产品中添加自定义选项卡
【发布时间】:2014-01-24 23:31:07
【问题描述】:

我正在尝试在 woocommerce 管理面板中为产品部分添加一个自定义选项卡,但它没有显示出来。有人可以引导我朝着正确的方向前进吗?我正在尝试作为一个班级来做。

<?php
/*
    Plugin Name: Cdog Woocomerce Product Options
    Description: Allow a customer to order several different options of one product under one line item.
    Version: 1.0
    Author: Clint Chaney
*/

class cdog_product_options
{

    public function __construct()
    {
        add_action( 'woocommerce_product_write_panel_tabs', array( &$this, 'create_admin_tab' ) );
    }

    /* this creates the tab in the products section in the admin panel */
    public function create_admin_tab()
    {
        ?>
        <li class="cdog_product_options_tab"><a href="#cdog_product_options"><?php _e('Product Options', 'woocommerce'); ?></a></li>
        <?
    }

} // end class

$cdog_product_options = new cdog_product_options();

【问题讨论】:

    标签: php wordpress class woocommerce


    【解决方案1】:

    嗯,解决方案很简单,我觉得很愚蠢,但最后我忘了创建对象。

    在上面的代码中添加了这个

    $cdog_product_options = new cdog_product_options();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-04-08
      • 2018-09-22
      • 1970-01-01
      • 2021-07-24
      • 2021-01-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多