mercredi 26 février 2020

Echo in one line

It's my first post, so I hope that I am doing everything correct.

I want to add the following PHP code to my site. The code is supposed to display 1-3 images depending on the product ID. The first image displays on every product page, the next two will be displayed depending on the id.

Everything is working great, but I am not able to display images in one row. Right now, the images are displayed under each other.

Would you be able to advise me?

/**
 * Add a selling points to single product page
 */
add_action( 'woocommerce_before_add_to_cart_form', 'bbloomer_single_product_ID', 10 );

function bbloomer_single_product_ID() {
 if(is_single()){
    echo '<div class="product_delivery_icon">
        <div class="pdf">
          <div class="pdf_icon">
            <img src="demo1.png">
          </div>
          <div class="pdf_name">Description 1</div>
        </div>
  </div>';
}if (is_single(array(1, 2, 3))){
    echo '<div class="product_delivery_icon">
        <div class="pdf">
          <div class="pdf_icon">
            <img src="demo2.png">
          </div>
          <div class="pdf_name">Description 2</div>
        </div>
  </div>';
}if (is_single(array(2, 4))){
    echo '<div class="product_delivery_icon">
        <div class="pdf">
          <div class="pdf_icon">
            <img src="demo3.png">
          </div>
          <div class="pdf_name">Description 3</div>
        </div>
  </div>';
}
}

Aucun commentaire:

Enregistrer un commentaire