• Resolved cazhou

    (@cazhou)


    Hi, I have been developing my woocommerce website using elementor. I have set up a product archive page which responds to a product tag in my category page. The trouble is each tag has several products in it, so my product archive shows several products under the one tag heading. I would like to have a main picture, a heading and a text box explaining the items in that particular product archive at the top of the archive page.

    I tried saving this information as a post and saving the same product tags as post tags hoping that the product tag could also access the post tag, which it doesn’t. I also tried looking for a plugin which could save Images and text to a product tag, which I couldn’t find. Any help would be appreciated.

    The page I have linked to is specifically for Solid Shampoos, it is not a product archive. I have built the page and linked to the actual page from my categories. What I want to do is link to the page by using the tag for Solid Shampoos, which would allow me to link to any tag and have one page for product archives rather than having 30 or more pages.
    When I do link to a product archive page I cannot get the heading I have on this page (specifically the two images, heading and text splurge).
    If you access the page and go back to Bathroom heaven and click on “Pure Body Butter” at the top of the category you will see my product archive page without the heading.
    Sorry about the long-winded post but I really want to get across what I am looking for.

    • This topic was modified 3 years, 6 months ago by cazhou.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Saif

    (@babylon1999)

    Hello @cazhou,

    If I understand you correctly, you want to add a short description with an image in your tags archive pages like this one: https://classicgifts.co.uk/product-tag/bb/

    First, you can already add a description to your tag pages by default. 🙂

    I didn’t find any ready-to-use plugins to add images, but you can try creating a short code for adding images and embedding it in the description.

    To create the short code, please add the following code to your site.

    function img_shortcode($atts)
    {
        // Attributes
        $atts = shortcode_atts(
            [
            'src' => '',
            'link_to_img' => '',
            ], $atts, 'img'
        );
    
        $return = '';
        if ($atts['link_to_img'] == 'yes')
        {
            $return = '<a href="' . $atts['src'] . '">
                        <img src="' . $atts['src'] . '"/>
                    </a>';
        }
        else{
            $return = '<img src="' . $atts['src'] . '"/>';
        }
        // Return HTML code
        return $return;
    }
    
    add_shortcode('img', 'img_shortcode');

    Source

    You can add it to your functions.php file or use a plugin like Code snippet.

    Now your site has the following shortcode enabled [img] which you can add to the description like this [img src="https://i.imgur.com/yorkr1G.png" link_to_img="yes"] (Replace the link with the image you want).


    Link to image: https://d.pr/i/lkdNlI


    Link to image: https://d.pr/i/sEo1sy

    Hope this helps!

Viewing 1 replies (of 1 total)

The topic ‘Linking to woocommerce tags’ is closed to new replies.