Skip to main content

Tag: PHP

htaccess background image

What is .htaccess file? – How to redirect PHP file?, Example of .htaccess file.

What is .htaccess file?

hello world!!! .htaccess is a configuration file that use To ran Apache web server software. .htaccess file is it’s very helpful to redirect SSL certificate http to https. 404 not found page error redirection to a web page. In .htassess rewrite code we will fix URL canonization. .htaccess rewrite code we will override the default behavior of Apache server. It’s very helpful to secure a web application from the hackers.

Read More

Woocommerce Product Category Featured Image

How to Display Woocommerce Product Category Featured Image on Category Archive Page.

Paste this code in functions.php file to show featured image of WordPress Woocommerce product category page.

/**
 * Display category image on category archive
 */
add_action( 'woocommerce_archive_description', 'woocommerce_category_image', 2 );
function woocommerce_category_image() {
  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 );
    if ( $image ) {
    echo '<img src="' . $image . '" alt="' . $cat->name . '" />';
  }
  }
}