Viewing 5 replies - 1 through 5 (of 5 total)
  • Try this in functions.php of your child theme:

    add_action('woocommerce_single_product_image_html', 'add_text');
    function add_text($html) {
      $html .= '<span class="add_text">My additional text.</span>'.PHP_EOL;
      return $html;
    }

    Thread Starter confused

    (@nicole2010)

    Thanks for the reply but the code is showing up at the top of the page before the page. It is not showing “My additional text” but the code as well.

    I am using Genesis theme if that matters.

    Did you put it in functions.php? If its the first snippet in there, you must start with

    <?php

    to start the php interpreter.

    Thread Starter confused

    (@nicole2010)

    I put it in the custom code. Once I started with the php interpreter it didn’t appear as code anymore but I also didn’t see the output (“My additional text”).

    Could I insert the code instead of the title that appears after the image and just before related products”. I don’t need that title so maybe I can replace it with the text that I want instead of adding another field.

    Please post the url to your site.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to add text after product image’ is closed to new replies.