• Hallo,
    Ich habe in meinem Child-Theme product-tabs in die functions.php eingebaut, aber die ?nderungen werden nicht angezeigt, bzw nicht übernommen.

    Wo liegt der Fehler ?

    /**
    * WooCommerce – Individuelles Produkt-Feld hinzufügen
    */

    add_action( ‘woocommerce_product_options_general_product_data’, ‘add_custom_product_field’ );

    function add_custom_product_field() {
    woocommerce_wp_textarea_input(
    array(
    ‘id’ => ‘_custom_tab_description’,
    ‘label’ => __( ‘Custom Tab Description’ )
    )
    );
    }

    add_action( ‘woocommerce_process_product_meta’, ‘save_custom_product_field’ );

    function save_custom_product_field( $post_id ){

    $custom_tab_description = $_POST[‘_custom_tab_description’];

    if( !empty( $custom_tab_description ) ) :
    update_post_meta( $post_id, ‘_custom_tab_description’, esc_html( $custom_tab_description ) );
    endif;
    }

    /**
    * WooCommerce – Individuelle Produkt-Tabs hinzufügen
    */

    add_filter( ‘woocommerce_product_tabs’, ‘add_woocommerce_product_tabs’ );

    function add_woocommerce_product_tabs( $tabs ) {
    $tabs[‘custom_tab’] = array(
    ‘title’ => __( ‘New Product Tab’ ),
    ‘priority’ => 50,
    ‘callback’ => ‘new_product_tab_callback’
    );

    return $tabs;
    }

    function new_product_tab_callback() {
    global $post;

    echo wpautop( get_post_meta( $post->ID, ‘_custom_tab_description’, true ) );
    }

    /**
    * WooCommerce – Individuelle Produkt-Tabs hinzufügen
    */

    add_filter( ‘woocommerce_product_tabs’, ‘add_woocommerce_product_tabs’ );

    function add_woocommerce_product_tabs( $tabs ) {
    $tabs[‘custom_tab’] = array(
    ‘title’ => __( ‘New Product Tab’ ),
    ‘priority’ => 50,
    ‘callback’ => ‘new_product_tab_callback’
    );

    return $tabs;
    }

    function new_product_tab_callback() {
    echo ‘New Product Tab’;
    echo ‘Here\’s your new product tab.’;
    }

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Product tabs function.php’ is closed to new replies.