Setting Condition for PDF in Flyout Menu

I’ve got a dropdown menu with different curriculum subjects. Each curriculum has a flyout with a link to Student Workbook PDF accessible in /wp-content/ files.

I’ve got the correct PDF links to show up, but the problem is that the looper is looping through all the PDFs for each flyout instead of just the one related to the subject (see below):

I’ve set for each parent page (Algebra, Data Science, etc.) a ACF field called Common Course URL that sets a Curriculum Materials post URL that the page should be associated with. For example, the Algebra page has the Common Course URL /algebra_pyret

This URL is brought into the Workbook PDF URL see below:
https://bootstrapfostg.wpenginepowered.com/wp-content/themes/pro-child/static-resources/fall-2025/en-us/courses/algebra-pyret/workbook/workbook.pdf

How can I connect this flyout to each respective PDF link? Ex: Algebra > Student Workbook link?

I’m adding a secure note with access to the site here. You’ll find the dropdown named Curriculum Dropdown.

Hello @OctoCog,

Thanks for writing in! What you are doing at the moment may not work or not a future proof solution. The best recommendation I can give is to lay out first the relationship between the pages, taxonomy and the files. How the files relates to the Algebra and the workbooks. You will need need to plot the Looper element structure. I can see that you have the Common Course URL as an ACF field. It would be easier if you just create another ACF field for the WorkBook File link URL.

Best Regards.

@ruenel I do like your idea, but I think I may have figured out a solution.

I changed the URL of the Student Workbook link to
/wp-content/themes/pro-child/static-resources/{{ term.slug }}/en-us/courses{{ acf.post_field({ “post”: looper.field({“key”:“ID”, “depth”: 2}), “field”:“common_course_url” }) }}/workbook/workbook.pdf

Seeing as I can still pull in the current season term slug and just reuse the common-course_url, I was able to build out the URL accordingly. I also removed the looper for the courses around the Workbooks Container, so the repeating part is gone now.

Hi @OctoCog,

Glad that we are able to help you find the solution.

Thanks