Search
 
SCRIPT & CODE EXAMPLE
 

PHP

how to get woocommerce category image

// verify that this is a product category page
if ( is_product_category() ){
    global $wp_query;

    // get the query object
    $cat = $wp_query->get_queried_object();

    // get the thumbnail id using the queried category term_id
    $thumbnail_id = get_term_meta( $cat->term_id, 'thumbnail_id', true ); 

    // get the image URL
    $image = wp_get_attachment_url( $thumbnail_id ); 

    // print the IMG HTML
    echo "<img src='{$image}' alt='' width='762' height='365' />";
}
Comment

how to get woocommerce category image

// verify that this is a product category page
if ( is_product_category() ){
    global $wp_query;

    // get the query object
    $cat = $wp_query->get_queried_object();

    // get the thumbnail id using the queried category term_id
    $thumbnail_id = get_term_meta( $cat->term_id, 'thumbnail_id', true ); 

    // get the image URL
    $image = wp_get_attachment_url( $thumbnail_id ); 

    // print the IMG HTML
    echo "<img src='{$image}' alt='' width='762' height='365' />";
}
Comment

PREVIOUS NEXT
Code Example
Php :: php top frameworks 
Php :: laravel old value for select option 
Php :: php sql query where in array 
Php :: how to add attributes to an object in php 
Php :: wordpress thumbnail 
Php :: laravel eloquent where id not equal to 
Php :: Laravel Validation error message in blade or view 
Php :: check value falls between in two range in php 
Php :: how to know the path of php in linux 
Php :: wordpress plugin add stylesheet 
Php :: docker check php version 
Php :: date and time in php 
Php :: how to use multiple permission in blade 
Php :: laravel database get all 
Php :: Barcode generator example using milon/barcode in laravel 
Php :: How to validate a file type in laravel 
Php :: blade condition if else laravel 
Php :: php replace blackslash 
Php :: sql in php 
Php :: php file upload error 
Php :: merge two query results in laravel 
Php :: mac os down upgrade php 
Php :: laravel sail publish 
Php :: separate numbers with commas laravel 
Php :: laravel disable csrf token 
Php :: php get day number 
Php :: use model from variable laravel 
Php :: php foreach random 
Php :: redirect woocommerce thank you 
Php :: php uppercase first letter 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =