Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/266.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何将自定义字段添加到商品属性_Php_Wordpress_Woocommerce_Wp Admin - Fatal编程技术网

Php 如何将自定义字段添加到商品属性

Php 如何将自定义字段添加到商品属性,php,wordpress,woocommerce,wp-admin,Php,Wordpress,Woocommerce,Wp Admin,我想在编辑属性表单中包含一个简单的属性。 /wp admin/edit.php?post_type=product&page=product_attributes&edit=55 这可能吗?我在SO上找到的所有内容都与向产品或分类法添加字段有关,如果我没有错的话,产品属性与分类法不同 我想在我的品牌产品属性中添加自定义表单 以下是我在使用和不使用pa时的尝试: add_action('pa_brand_edit_form_fields','msp_pa_brand_form_fields');

我想在编辑属性表单中包含一个简单的属性。 /wp admin/edit.php?post_type=product&page=product_attributes&edit=55

这可能吗?我在SO上找到的所有内容都与向产品或分类法添加字段有关,如果我没有错的话,产品属性与分类法不同

我想在我的品牌产品属性中添加自定义表单

以下是我在使用和不使用pa时的尝试:

add_action('pa_brand_edit_form_fields','msp_pa_brand_form_fields');
add_action('pa_brand_add_form_fields','msp_pa_brand_form_fields');

function msp_pa_brand_form_fields () {
?>
    <tr class="form-field">
            <th valign="top" scope="row">
                <label for="display"><?php _e('Display Type', ''); ?></label>
            </th>
            <td>
                <select name="display_type">
                    <option value="select">Select</option>
                    <option value="variation_image">Variation Image w/ label</option>
                </select>
            </td>
        </tr>
        <?php 
    }
我只是需要帮助获得一些html显示在这个编辑屏幕上。我的总体计划是将这个select标记添加到每个属性中,然后将一段代码添加到variable.php中检查属性的显示方式

非常感谢您的帮助

使用以下钩子,您可以根据自己的意愿在前面或后面添加字段

编辑属性字段之前的功能操作{ ?> 选择 带标签的变体图像 选择 带标签的变体图像 使用以下钩子,您可以根据自己的意愿在前面或后面添加字段

编辑属性字段之前的功能操作{ ?> 选择 带标签的变体图像 选择 带标签的变体图像