35758

Display additional product information (e.g. image caption) when hovering product image

Question:

I'm using using the WooCommerce plugin for WordPress to display my products. The thing is, when you are viewing the product category (archive), you can see the product name, image and price, but that doesn't really say all that much about exactly what the product is.

What I would like is for some more information to become available when you hover the product images. Something a bit like <a href="http://shop.herriottgrace.com" rel="nofollow">this</a>. Would it be possible to retrieve some of the information about the image, that I can enter in the WordPress media libray: title, caption alt text or description?

You can check the webshop <a href="http://renservice.dk/produkt-kategori/universalrengoering" rel="nofollow">here</a>.

<strong>EDIT:</strong>

I found that editing the content-product.php file in the WooCommerce plugin folder, if I put this:

?> random text <?php

somewhere inside the php tags in the <li> section of that file, I could get 'random text' to show either above or below the product image on the product archive page. So, if I could replace that with a function that would retreive for instance the product image caption or some custom field that I can fill out for each product, that would go a long way towards solving the issue. So, if anyone knows of a function that does this, please share it here.

Answer1:

hello sir just use this plugin https://wordpress.org/plugins/woocommerce-custom-product-data-fields/ for retrieving any costume fields do like this Retrieving multiselect value global $wc_cpdf; $multiselect = $wc_cpdf->get_value($post->ID, '_mymultiselect'); foreach ($multiselect as $value) { echo $value; } Retrieving image value global $wc_cpdf; $image_id = $wc_cpdf->get_value($post->ID, '_myimage'); $size = 'thumbnail'; $image_attachment = wp_get_attachment_image($image_id, $size); echo $image_attachment; }

Recommend

  • How to use Partial Views in ASP.NET MVC?
  • Opencart: Cannot call controller with $this->url->link and curl
  • SCSS Language Injection in Pycharm
  • How to change default stop edit behavior in jtable
  • window.onbeforeunload in javascript
  • goJS dropdown remove items
  • File loader changed image file name but not the file name in HTML file
  • Outputting SharePoint Hyperlink Column as URL
  • How can the INSERT … ON CONFLICT (id) DO UPDATE… syntax be used with a sequence ID?
  • QLPreviewController hide print button in ios6
  • Recording logins for password protected directories
  • Master page gives error
  • Splitting given String into two variables - php
  • Uncaught Error: Could not find module `ember-load-initializers`
  • What is Eclipse's Declaration View used for?
  • Fetching methods from BroadcastReceiver to update UI
  • DotNetZip - Calculate final zip size before calling Save(stream)
  • Apache 2.4 and php-fpm does not trigger apache http basic auth for php pages
  • How to set/get protobuf's extension field in Go?
  • Check if a string to interpolate provides expected placeholders
  • Sending data from AppleScript to FileMaker records
  • Running a C# exe file
  • Symfony2: How to get request parameter
  • Upload files with Ajax and Jquery
  • Web-crawler for facebook in python
  • Do I've to free mysql result after storing it?
  • Google cloud sdk not working when python points python3
  • Why winpcap requires both .lib and .dll to run?
  • Warning: Can't call setState (or forceUpdate) on an unmounted component
  • GridView Sorting works once only
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • A cron job substitute?
  • json Serialization in asp
  • WPF Applying a trigger on binding failure
  • trying to dynamically update Highchart column chart but series undefined
  • Load html files in TinyMce
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • Free memory of cv::Mat loaded using FileStorage API
  • coudnt use logback because of log4j
  • java string with new operator and a literal