• Resolved Jimmy Symmonds

    (@jimmy-symmonds)


    Hello Eliot

    Just got this downloaded yesterday and been reading and trying for hours to do this, please help.

    I used Custom Post Type UI and ACF to create custom post type, taxonomies and fields.

    I am trying to list the custom taxonomies of post as inline list of clickable links taking one to the archive page for that taxonomy.

    For example I set up custom post type – Plant Profile
    and custom taxonomy – Plant Actions
    and custom field of type taxonomy accepting multiple entries in AFC

    I have used this –

    <a href="[taxonomy plant-actions link="url"]">[taxonomy plant-action]</a>

    It works with one entry, but with multiple entries in field it creates one long link.

    Does that make sense?

    I want the output to look like this:

    Plant action: antiseptic, emollient, astringent

    where the actions are clickable and link to the archive page.

    Thank you!
    Jimmy

    https://ww.wp.xz.cn/plugins/custom-content-shortcode/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Eliot Akira

    (@miyarakira)

    I think the issue is this part:

    <a href="[taxonomy plant-actions link="url"]">

    Because the shortcode is inside “double quotes” already, it’s necessary to use ‘single quotes’ for parameters. Also, to display the URL, you can use field=”url”.

    <a href="[taxonomy plant-actions field='url']">

    Please let me know if that works for you.

    Thread Starter Jimmy Symmonds

    (@jimmy-symmonds)

    Thank you for helping Eliot.
    The problem persists.
    The Taxonomy is listing correctly:

    Parts Used: Leaf sap
    Actions: Anti-inflammatory, Antibacterial, Demulcent, Emollient, Vulnerary

    The lower list with multiple entries, is not hyperlinking individual entries, rather the entire list, including the ,’s are linking together to this –

    http://happybynature.co.za/plant-actions/anti-inflammatory/,%20http://happybynature.co.za/plant-actions/antibacterial/,%20http://happybynature.co.za/plant-actions/demulcent/,%20http://happybynature.co.za/plant-actions/emollient/,%20http://happybynature.co.za/plant-actions/vulnerary/

    The code I am using is your suggestion, and the same happens whether I use link/url and ‘/”.

    <strong>Actions:</strong> <a href="[taxonomy plant-actions field='url']">[taxonomy plant-actions]
    </a>
    Plugin Author Eliot Akira

    (@miyarakira)

    Ah, I understand – it’s listing multiple taxonomy terms all in one line. Yes, I can see why this is a confusing result. The best way to achieve what you want is to create a loop to display each taxonomy term.

    <b>Actions:</b>
    [for each="plant-actions" current="true"]
      <a href="[each ur]">[each name]</a>
    [/for]

    The formatting might need adjustment, but this should list each taxonomy term linked to its archive.

    Thread Starter Jimmy Symmonds

    (@jimmy-symmonds)

    🙂 perfect.

    Referencing settings>each I adjusted to display inline, with commas separating, using ‘trim’ to drop last comma. Also discovered you can use [each link] to pull the url, so both the examples below produce the correct output.

    [for each="plant-actions" current="true" trim="true"]<a href="[each url]">[each name]</a>, [/for]

    [for each="plant-actions" current="true" trim="true"][each link], [/for]

    Thank you very much Eliot, all sort of possibilities come in to view now.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Taxonomy as links’ is closed to new replies.