• I´m using woocommerce and I need a link back to parent category on every single product and category pages. Already read several posts in the web but couldn´t not make it work as I need.

    I was thinking to output the function in the sidebar when necessary via a text widget plugin that accepts php. Where do I insert the function as i´m using woocomerce, and I think theme uses different templates for single product and category pages? Just in functions.php?

    So, could you please help to do the function code and the html output? Thanks in advance

    https://wordpress.org/plugins/woocommerce/

Viewing 1 replies (of 1 total)
  • Thread Starter Pipeliners

    (@pipeliners)

    Tried this one with no success:

    In function.php

    function the_parent_link() { global $post; if ( !$post->post_parent ) return;

    echo ‘post_parent) ) . ‘”>’ . apply_filters( ‘the_title’, get_the_title($post->post_parent) ) . ”; } ?>

    In the php text widget: <?php the_parent_link(); ?>

Viewing 1 replies (of 1 total)
  • The topic ‘Link Back to Parent Category – Woocommerce’ is closed to new replies.