• 03-10-2020, 02:06:41
    #10
    Developer
    function shop_remove_attributes( $attributes ) {
    if( is_shop() ){
    if( isset( $attributes['pa_color'] ) ){
    unset( $attributes['pa_color'] );
    }
    if( isset( $attributes['pa_color2'] ) ){
    unset( $attributes['pa_color2'] );
    }
    }
    return $attributes;
    }
    add_filter( 'woocommerce_product_get_attributes', 'shop_remove_attributes' );
    exclude edeceğiniz bölümler:
    pa_color
    pa_color2
  • 03-10-2020, 17:09:38
    #11
    Üyeliği durduruldu
    brown adlı üyeden alıntı: mesajı görüntüle
    function shop_remove_attributes( $attributes ) {
    if( is_shop() ){
    if( isset( $attributes['pa_color'] ) ){
    unset( $attributes['pa_color'] );
    }
    if( isset( $attributes['pa_color2'] ) ){
    unset( $attributes['pa_color2'] );
    }
    }
    return $attributes;
    }
    add_filter( 'woocommerce_product_get_attributes', 'shop_remove_attributes' );
    exclude edeceğiniz bölümler:
    pa_color
    pa_color2
    Hocam kodu şu şeikilde yaptım ama olmadı nerede hata yapıyorum sizce
    ve şöyle de hata alıyorum

    PHP kod değişiklikleriniz wp-content/themes/yanka/functions.php dosyasındaki satır 53 yüzünden geri alındı. Lütfen düzeltin ve tekrar kaydetmeyi deneyin.
    Cannot redeclare shop_remove_attributes() (previously declared in wp-content/themes/yanka/functions.php:53)Gizle



    l
    function custom_attributes_display(){
    global $product;
    function shop_remove_attributes( $attributes ) {
    if( is_shop() ){
    if( isset( $attributes['pa_yakit-ekonomisi'] ) ){
    unset( $attributes['pa_yakit-ekonomisi'] );
    }
    if( isset( $attributes['pa_yakit-ekonomisi'] ) ){
    unset( $attributes['pa_yakit-ekonomisi'] );
    }
    }
    return $attributes;
    }
    add_filter( 'woommerce_product_get_attributes', 'shop_remove_attributes', 20);
    
    // Just for simple products
    if( ! $product->is_type( 'simple' ) ) return;
    
    $loop_count = 0;
    
    echo '<div>';
    
    // Get the attributes taxonomy slugs (Updated and dynamic now)
    $attributes_taxonomy = $product->get_attributes();
    // OR set an indexed array of taxonomy slug (key) and name (value) to chose which ones, like:
    // $attributes_taxonomy = array('pa_nopeus' => 'Nopeus', 'pa_liito' => 'Liito, 'pa_vakaus' => 'Vaukaus' );
    
    foreach( $attributes_taxonomy as $taxonomy => $attribute ) {
    
    // Getting the term names of an attribute (set in a coma separated string if many values)
    $attribute_terms = wp_get_post_terms( get_the_id(), $taxonomy, array( 'fields' => 'names' ) );
    $terms_string = implode( ',', $attribute_terms );
    
    // Displays only if attribute exist for the product
    if( count( $attribute_terms ) > 0 ){ // Updated
    echo '<p style="border:solid">'.$attribute->get_name().' : '.$terms_string.'</p>';
    
    // Separating each number by a " | " (Updated and dynamic now)
    $attr_count = count( $attributes_taxonomy );
    $loop_count++;
    }
    }
    
    echo '</div>';
    }
  • 03-10-2020, 17:21:40
    #12
    Developer
    Fonsiyon içine fonksiyon eklemişsiniz. Bunu verdiğim şekilde ayrı olarak fonksiyon dosyanıza eklemelisiniz.
  • 03-10-2020, 18:24:02
    #13
    Üyeliği durduruldu
    brown adlı üyeden alıntı: mesajı görüntüle
    Fonsiyon içine fonksiyon eklemişsiniz. Bunu verdiğim şekilde ayrı olarak fonksiyon dosyanıza eklemelisiniz.
    BÖyle yaptım yine olmadi size mesaj atabilir miyim
    function shop_remove_attributes( $attributes ) {
    if( is_shop() ){
    if( isset( $attributes['pa_gurultu-seviyesi'] ) ){
    unset( $attributes['pa_gurultu-seviyesi'] );
    }
    if( isset( $attributes['pa_gurultu-seviyesi'] ) ){
    unset( $attributes['pa_gurultu-seviyesi'] );
    }
    }
    return $attributes;
    }
  • 03-10-2020, 19:38:33
    #14
    Developer
    Özel bir düzenlemeymiş. PM'den yardımcı oldum.
  • 03-10-2020, 21:44:18
    #15
    Üyeliği durduruldu
    brown adlı üyeden alıntı: mesajı görüntüle
    Özel bir düzenlemeymiş. PM'den yardımcı oldum.
    İşinin cidden ehli kendisine çok teşekkür ediyorum