Friday, January 6, 2023
HomeWordPress Developmentclasses - Add custm fields to Woocommerce Class Web page

classes – Add custm fields to Woocommerce Class Web page


I need to add customized fields to Class Woocommerce objects (page-products-cat);
I’ve tried utilizing this code however It doesn’t work :

add_action(‘product_cat_edit_form_fields’, ‘wh_taxonomy_edit_meta_field’, 10, 1);

//Product Cat Edit web page
operate wh_taxonomy_edit_meta_field($time period) {

    //getting time period ID
    $term_id = $term->term_id;

    // retrieve the prevailing worth(s) for this meta subject.
    $wh_meta_title = get_term_meta($term_id, ‘wh_meta_title’, true);
    $wh_meta_desc = get_term_meta($term_id, ‘wh_meta_desc’, true);
    ?>
    <tr class="form-field">
        <th scope="row" valign="high"><label for="wh_meta_title"><?php _e(‘Meta Title’, ‘wh’); ?></label></th>
        <td>
            <enter kind="textual content" title="wh_meta_title" id="wh_meta_title" worth="<?php echo esc_attr($wh_meta_title) ? esc_attr($wh_meta_title) : ”; ?>">
            <p class="description"><?php _e(‘Enter a meta title, <= 60 character’, ‘wh’); ?></p>
        </td>
    </tr>
    <tr class="form-field">
        <th scope="row" valign="high"><label for="wh_meta_desc"><?php _e(‘Meta Description’, ‘wh’); ?></label></th>
        <td>
            <textarea title="wh_meta_desc" id="wh_meta_desc"><?php echo esc_attr($wh_meta_desc) ? esc_attr($wh_meta_desc) : ”; ?></textarea>
            <p class="description"><?php _e(‘Enter a meta description’, ‘wh’); ?></p>
        </td>
    </tr>
    <?php
}

Thanks prematurely

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments