I am trying to get the alt to display as it is written within the media library, but the necessary code edit is beyond my comprehension. The code below was created to modify wooCommerce. The best I could do now is to narrow down here the edit needs to take place. This line is one that needs edited, but I am uncertain what to change:
if ($image) echo '<img src="' . esc_url($image) .'" alt="EDIT HERE:plugins>woocommerce-CJD">';
Any help showing me how to get the alt tag to display would be greatly appreciated! Thank you
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
add_action('after_setup_theme', 'WC_CJD_tweak_action_hooks');
function WC_CJD_tweak_action_hooks () {
// put sorting before category list
remove_action( 'woocommerce_after_shop_loop', 'woocommerce_catalog_ordering', 30 );
remove_action( 'woocommerce_after_shop_loop', 'woocommerce_result_count', 20 );
add_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_ordering', 30 );
add_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 );
}
// add breadcrumb
add_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 1 );
add_filter( 'woocommerce_breadcrumb_defaults', 'WC_CJD_modify_breadcrumb' );
function WC_CJD_modify_breadcrumb ($defaults) {
$defaults['delimiter'] = '';
return $defaults;
}
// add category header area with image
add_action('woocommerce_archive_description', 'WC_CJD_wrap_cat_descr_open', 2);
add_action('woocommerce_archive_description', 'WC_CJD_wrap_cat_descr_close', 99);
function WC_CJD_wrap_cat_descr_open () {
if (is_product_category()) {
global $wp_query;
$cat = $wp_query->get_queried_object();
$thumbnail_id = intval(get_woocommerce_term_meta($cat->term_id, 'thumbnail_id', true));
$image = wp_get_attachment_image_url($thumbnail_id, 'shop_catalog');
echo '<div class="cat-header">';
if ($image) echo '<img class="cat-header-bg" src="' . esc_url($image) . '" alt="" />';
echo '<div class="cat-header-content">';
echo '<div class="cat-header-text">';
echo '<h1> Wholesale ' . $cat->name . ' </h1>';
}
}
function WC_CJD_wrap_cat_descr_close () {
if (is_product_category()) {
global $wp_query;
$cat = $wp_query->get_queried_object();
$thumbnail_id = intval(get_woocommerce_term_meta($cat->term_id, 'thumbnail_id', true));
$image = wp_get_attachment_image_url($thumbnail_id, 'shop_catalog');
echo '</div>';
if ($image) echo '<img src="' . esc_url($image) .'" alt="EDIT HERE:plugins>woocommerce-CJD">';
echo '</div>';
echo '</div>';
}
}