Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter designforhumansstudio

    (@designforhumansstudio)

    Thanks a lot for your idea. But there was still a little detail missing, what I found out only now (two days later). The closing tag of [pass vars] was missing. But now it works perfectly:

    [loop type=courses orderby=year_for_sorting]
    
    [pass vars]
    [if field=year_for_sorting not value='{LAST}']
    [set mtocount][calc]mtocount+1[/calc][/set]
    [/if]
    [/pass]
    
    [set last][field year_for_sorting][/set]
    
    [/loop]
    Thread Starter designforhumansstudio

    (@designforhumansstudio)

    Thank you for the quick reply. I tried your idea, but does not change the results. It always considers both variables different, also in the last test, when they both contain “2020”. You can see that on the website, where I show the content of the three variables… Any other idea?

    • This reply was modified 3 years, 4 months ago by designforhumansstudio. Reason: I didn't see the first solution in my email
    Thread Starter designforhumansstudio

    (@designforhumansstudio)

    Thank you so much! This last idea helped me to create the final shortcode:

    [set last][/set]
    [loop type=publications orderby=publication_type]
    [pass field=publication_type]
    [if var=last not value='{FIELD}’]
    <h2 class=”publist”>[field publication_type]</h2>
    [-loop type=publications field=publication_type value='{FIELD}’ orderby=field_num key=publication_date order=DESC]
    <p class=”publist”>[field image size=Medium size][field authors] ([field acf_date=publication_date date_format=”Y”]): [field title-link]. [field publisher].</p>
    [set last][field publication_type][/set]
    [/-loop]
    [/if]
    [/pass]
    [/loop]

    It works as it should. I am super happy about this solution!

    Thread Starter designforhumansstudio

    (@designforhumansstudio)

    Thanks a lot! This looks already much better:
    https://julianculp.academicwebs.com/publications/

    I now only need to solve the problem that the first loop goes through all publications and not only through the 2 different publication_type(s). How could I show each publication type only once?

    Here is my new shortcode:

    [loop type=publications orderby=publication_type]
    [pass field=publication_type]
    <h2 class=”publist”>[field publication_type]</h2>
    [-loop type=publications field=publication_type value='{FIELD}' orderby=field_num key=publication_date order=DESC]
    <p class=”publist”>[field image size=Medium size][field authors] ([field acf_date=publication_date date_format=”Y”]): [field title-link]. [field publisher].</p>
    [/-loop]
    [/pass]
    [/loop]

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