Jut updated wordpress and woocommerce to the latest versions. Unfortunately im getting a 500 Internal Server somewhere in the following lines:
add_action( 'woocommerce_before_shop_loop_item', 'attribute_img_loop', 20 );
function attribute_img_loop() {
global $post;
$attribute_names = array( 'pa_sertifikalar' ); // Add attribute names here and remember to add the pa_ prefix to the attribute name
// echo '<script>alert('.$attribute_names.');</script>';
foreach ( $attribute_names as $attribute_name ) {
$taxonomy = get_taxonomy( $attribute_name );
if ( $taxonomy && ! is_wp_error( $taxonomy ) ) {
$terms = wp_get_post_terms( $post->ID, $attribute_name );
$terms_array = array();
if ( ! empty( $terms ) ) {
echo '
<table class="combs" cellspacing="0">
<tbody>
<tr>
<td>
<ul class="nm-variation-control ul-control-certificate">';
foreach ( $terms as $term ) {
$thumb_id = get_woocommerce_term_meta( $term->term_id, 'thumbnail_id', true );
$image_id = absint( get_term_meta( $term->term_id, 'nm_pa_image_thumbnail_id', true ) );
$img_src = ( $image_id ) ? wp_get_attachment_url( $image_id ) : '';
$archive_link = get_term_link( $term->slug, $attribute_name );
$full_line = '<li><div class="lcrap"><img id="c'. $image_id .'" data-src="'. $img_src .'" alt="" class="lazyload" alt="'. $term->name .'" /></div></li>';
array_push( $terms_array, $full_line );
}
// echo $taxonomy->labels->name . ' ' . implode( $terms_array, '-- ' );
echo implode( $terms_array, '');
echo '</ul>
</td>
</tr>
</tbody>
</table>';
}
}
}
}
Just added echo '<script>alert('.$attribute_names.');</script>';
to check the output from the $attribute_names = array( 'pa_sertifikalar' );
part and saw it returns a
function Array() {
[native code]
}
Logfiles are saying:
The get_woocommerce_term_meta function is deprecated since version 3.6. Replace with get_term_meta.
Replaced it with get_term_meta - still the same. Any idea whats going on here?
The get_woocommerce_term_meta function is deprecated since version 3.6. Replace with get_term_meta.
Replaced it with get_term_meta - still the same.