Search
 
SCRIPT & CODE EXAMPLE
 

PHP

wc get product image

<?php global $product; ?>
<img src="<?php echo wp_get_attachment_url( $product->get_image_id() ); ?>" />
Comment

wc get product category image

    <?php
        if ( is_product_category() ){

            global $wp_query;
            $cat = $wp_query->get_queried_object();    
            $thumbnail_id = get_woocommerce_term_meta( $cat->term_id, 'thumbnail_id', true ); 
            $image = wp_get_attachment_url( $thumbnail_id ); 
            echo "<img src='{$image}' alt='' />";
        }
    ?>
Comment

PREVIOUS NEXT
Code Example
Php :: laravel set production 
Php :: woocommerce_variation_option_name on frontend 
Php :: Return length of string PHP 
Php :: how to install apache mysql php on ubuntu 18.04 
Php :: remove square brackets from string php 
Php :: php include multiple files at once 
Php :: transforming string to integer in php 
Php :: convert collection to array laravel 
Php :: php error handling 
Php :: Best Security tools for php 
Php :: magento 1.9 get all product 
Php :: in array php 
Php :: cron job every 5 minutes wordpress 
Php :: laravel PageController.php 
Php :: add action hook 
Php :: wordpress change slug programmatically 
Php :: install a package only composer dont update 
Php :: laravel validation check foreign key exists 
Php :: transient wp 
Php :: Get data from array (from an API) in Laravel 
Php :: php function to minify javascript and css 
Php :: laravel datatables 
Php :: add contact form 7 to page templat e 
Php :: cmd run php file 
Php :: permutation and combination program in php 
Php :: cara membuat koneksi php 
Php :: how to get favicon with Goutte php 
Php :: Add button next to "ADD TO CART" on product archive 
Php :: php mysql update all rows in table random values 
Php :: sort relation model count yii2 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =