• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Remove Img Title Prettyphoto lightbox Woocommerce Product Page

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Remove Img Title Prettyphoto lightbox Woocommerce Product Page

This topic is: resolved

Tagged: lightbox, prettyPhoto, WooCommerce

  • This topic has 10 replies, 3 voices, and was last updated 9 years, 6 months ago by plentyvegan.
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • July 18, 2016 at 12:59 pm #189752
    plentyvegan
    Member

    I can't find anywhere where I would be able to remove the image title from the popup gallery on product pages: http://plentyvegan.com/product/22-days-nutrition-plant-protein-powder/

    The code I can find in Woocommerce's theme is:

    FOR THUMBNAILS:
    echo apply_filters( 'woocommerce_single_product_image_thumbnail_html', sprintf( '%s', $image_link, $image_class, $image_caption, $image ), $attachment_id, $post->ID, $image_class );

    FOR SINGLE PRODUCT IMAGES:
    echo apply_filters( 'woocommerce_single_product_image_html', sprintf( '%s', $props['url'], $props['caption'], $image ), $post->ID );

    http://plentyvegan.com/product/22-days-nutrition-plant-protein-powder/
    July 21, 2016 at 10:23 am #189919
    Christoph
    Member

    Hi,

    I don't see an image title in the lightbox, just the product title.


    https://www.christophherr.com | Genesis Customizations | Buy me a coffee

    July 21, 2016 at 11:36 am #189939
    Genesis Developer
    Member

    Add this code in your child theme's functions.php.

    add_filter( 'woocommerce_single_product_image_thumbnail_html', 'gd_remove_title', 10, 4 );
    function gd_remove_title( $image_html, $attachment_id, $post_ID,	$image_class ) {
      $props = wc_get_product_attachment_props( $attachment_id );
      $image_html = sprintf(
    		'<a href="%s" class="%s" data-rel="prettyPhoto[product-gallery]">%s</a>',
    		esc_url( $props['url'] ),
    		esc_attr( $image_class ),
    		wp_get_attachment_image( $attachment_id, apply_filters( 'single_product_small_thumbnail_size', 'shop_thumbnail' ), 0, $props )
    	);
            
      return $image_html;
    }

    Download Genesis Featured Posts Combo Widget | Simple Grid Layouts Plugin for Posts, CPTs and terms
    You can request new tips/help.

    July 21, 2016 at 11:47 am #189943
    plentyvegan
    Member

    Christoph - I made the image titles the product titles. I removed the dashes. It looks like it's the product title but it's actually the image title that you are seeing.

    I added the code above but nothing seems to have changed: http://plentyvegan.com/product/daiya-foods-cheezy-mac/

    Thoughts?

    Thanks.

    July 21, 2016 at 12:29 pm #189948
    Genesis Developer
    Member

    Add this single line after the 3rd line (in above code).

    $props['alt'] = '';

    Otherwise you will target the wp_get_attachment_image_attributes filter and remove the alt.


    Download Genesis Featured Posts Combo Widget | Simple Grid Layouts Plugin for Posts, CPTs and terms
    You can request new tips/help.

    July 21, 2016 at 12:34 pm #189949
    plentyvegan
    Member

    I added the line above. The image title is still showing up in the lightbox on the product page.

    To recap, this is what I've added to the functions php file in the Divine Theme code:

    //* Remove image title
    add_filter( 'woocommerce_single_product_image_thumbnail_html', 'gd_remove_title', 10, 4 );
    function gd_remove_title( $image_html, $attachment_id, $post_ID, $image_class ) {
    $props = wc_get_product_attachment_props( $attachment_id );
    $props['alt'] = '';
    $image_html = sprintf(
    '%s',
    esc_url( $props['url'] ),
    esc_attr( $image_class ),
    wp_get_attachment_image( $attachment_id, apply_filters( 'single_product_small_thumbnail_size', 'shop_thumbnail' ), 0, $props )
    );

    return $image_html;
    }

    Thanks again for digging in with me.

    July 21, 2016 at 12:47 pm #189952
    Genesis Developer
    Member

    Remove the previous code and try this

    add_filter('wp_get_attachment_image_attributes', 'divine_remove_image_alt' );
    function divine_remove_image_alt( $atts) {
       if( is_singular('product') ) {
          unset( $atts['alt'] );
       }
       
       return $atts;
    }

    Download Genesis Featured Posts Combo Widget | Simple Grid Layouts Plugin for Posts, CPTs and terms
    You can request new tips/help.

    July 21, 2016 at 12:51 pm #189953
    plentyvegan
    Member

    Hmmm - no dice.

    July 21, 2016 at 1:01 pm #189956
    Genesis Developer
    Member

    I shall check it tomorrow morning


    Download Genesis Featured Posts Combo Widget | Simple Grid Layouts Plugin for Posts, CPTs and terms
    You can request new tips/help.

    July 21, 2016 at 1:17 pm #189957
    Genesis Developer
    Member

    I just tested this code and it is working for me

    add_filter('wp_get_attachment_image_attributes', 'divine_remove_image_alt' );
    function divine_remove_image_alt( $atts) {
       if( is_singular('product') ) {
          $atts['title'] = "";
          $atts['alt']   = "";
       }
       
       return $atts;
    }

    Download Genesis Featured Posts Combo Widget | Simple Grid Layouts Plugin for Posts, CPTs and terms
    You can request new tips/help.

    July 21, 2016 at 1:22 pm #189959
    plentyvegan
    Member

    Success!

    Thanks so much!

  • Author
    Posts
Viewing 11 posts - 1 through 11 (of 11 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble