Responsive Viewport Meta Tag


<meta name="viewport" content="width=device-width"/>

Which means “browser, render this website exactly as wide as you are naturally.”


<meta name="viewport" content="width=device-width, initial-scale=1.0"/>

The initial-scale=1.0 part sets the initial zoom level when the page is first loaded by the browser.

Add alt tags in product thumbnails in WooCommerce

Simply add below code in your theme’s function.php file.


add_filter('wp_get_attachment_image_attributes', 'change_attachement_image_attributes', 20, 2);

function change_attachement_image_attributes( $attr, $attachment ){
    // Get post parent
    $parent = get_post_field( 'post_parent', $attachment);

    // Get post type to check if it's product
    $type = get_post_field( 'post_type', $parent);
    if( $type != 'product' ){
        return $attr;
    }

    /// Get title
    $title = get_post_field( 'post_title', $parent);

    $attr['alt'] = $title;
    $attr['title'] = $title;

    return $attr;
}