• Resolved beware

    (@beware)


    this is weird, really weird
    Using a custom template for archive, i used the following code do display the brand logo on archive page.
    Sometimes it works, but for some brands, it shows nothing.

    Any clue ?

    //Brand hero page shortcode
    function custom_pwb_brand_info() {
        if( is_product_taxonomy() ){
        $brands = wp_get_post_terms( get_the_ID(), 'pwb-brand' );
        
        foreach( $brands as $brand ) {
          $attachment_id = get_term_meta( $brand->term_id, 'pwb_brand_image', true );
          $attachment_src = wp_get_attachment_image_src( $attachment_id,'full' );
          $brand_banner_id = get_term_meta($brand->term_id, 'pwb_brand_banner', true);
          $brand_banner_src = wp_get_attachment_image_src( $brand_banner_id,'full' );
          echo '<div class="row align-items-center">';
          echo '<div class="col-12 col-sm-6 text-center">';
          echo '<img src="'.$attachment_src[0].'" alt="">';
          echo '<p>'.$brand->description.'</p>';
          echo '</div>';
          echo '<div class="col-12 col-sm-6">';
          echo '<img src="'.$brand_banner_src[0].'" alt="">';
          echo '</div>';
          echo '</div>';
        }
      }
    }
    add_shortcode( 'custom_pwb_brand_info', 'custom_pwb_brand_info' );
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Logo on archive page doesnt appear sometimes’ is closed to new replies.