我正在尝试在 woocommerce 管理面板中的产品部分添加自定义选项卡,但它没有显示。有人可以引导我走向正确的方向吗?我正在尝试以类(class)形式进行。
<?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();
最佳答案
嗯,解决方案很简单,我觉得很愚蠢,但我忘记了最后创建对象。
将此添加到上面的代码中
$cdog_product_options = new cdog_product_options();
关于php - 在管理 woocommerce 产品中添加自定义选项卡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21344389/