0

i wants to get parent url of child categories like this Example: PRODUCTS & SERVICES > ENTERTAINMENT > SURPRISE PROMO.

PRODUCTS & SERVICES is my parent category, and ENTERTAINMENT is PRODUCTS & SERVICES's child category, and SURPRISE PROMO is ENTERTAINMENT's child category. so i need to get full url like this "www.example.com/products-services/entertainment/surprise-promo"

{exp:channel:categories category_group="1"}
    <a href="{category_url_title}">{category_name}</a>
{/exp:channel:categories}

Please help how to get full URL,

thanks in advance

2
  • You'll need to elaborate on exactly what you want to see in your output, this is unclear as it's written. Apr 30 '14 at 12:45
  • i wants to get parent url of child categories like this Example: PRODUCTS & SERVICES > ENTERTAINMENT > SURPRISE PROMO PRODUCTS & SERVICES is my parent category, and ENTERTAINMENT is PRODUCTS & SERVICES's child, and SURPRISE PROMO is ENTERTAINMENT's child. so i need to get full url like this "example.com/products-services/entertainment/surprise-promo"
    – Vky Arain
    Apr 30 '14 at 13:02
2

GW Code Categories is pretty much my goto addon for anything to do with manipulating category output. It has useful parameters & variables for this type of stuff: {complete_path} & {output_path} which would work in your case. There is also an example of category based breadcrumbs:

{exp:channel:entries channel="add-ons" limit="1"}
    <a href="{site_url}">Home</a> &raquo;
    {exp:gwcode_categories entry_id="{entry_id}" style="linear"}
        {if group_start}<a href="{path="add-ons"}">{cat_group_name}</a> &raquo;{/if}
        <a href="{path="add-ons/{cat_url_title}"}">{cat_name}</a> &raquo;
    {/exp:gwcode_categories}
    {title}
{/exp:channel:entries}

You could also swap {path="add-ons/{cat_url_title}"} for {complete_path} as it will successively build the URL's in each anchor.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.