• Resolved Stefancom

    (@stefancom)


    Hi,

    I am looking for some sort of conditional field solution. I have read already that those are not really available (yet). Is that still the case?

    But with Pods being such a powerful tool, I would imagine there must be some doable solution available?

    I have a calendar of concerts of musical compositions (Pod “performances”). And I have the respective list of those compositions (Pod “work”). (So, those two elements are related.) In the calendar, the musical compositions are linked to their single posts, featuring the detailed data from “work” Pod.

    Now, on these musical works’s detail pages, I would like to also list their performances, to be exact: only those of this very piece whose detailed post is seen at the moment. So, not of all performances in general, but only of those which feature this specific work.

    Is there a way? … Do I need make a new separate template?

    My “Work” Pod template to display a single musical composition looks as follows:

    <p>{@post_title} ({@year})<br>
    for {@instrumentation}:<br>
    {@duration} minutes
    
    <p><b>PERFORMANCES:</b>
    

    The Pod reference of “Performances” reads as follows:

    ID
    post_title
    post_content
    post_excerpt
    post_author
    post_date
    post_date_gmt
    post_status
    comment_status
    ping_status
    post_password
    post_name
    to_ping
    pinged
    post_modified
    post_modified_gmt
    post_content_filtered
    post_parent
    guid
    menu_order
    post_type
    post_mime_type
    comment_count
    comments
    composition
    concert_date
    venue_or_series
    performer
    facebook_event
    composition.ID
    composition.post_title
    composition.post_content
    composition.post_excerpt
    composition.post_author
    composition.post_date
    composition.post_date_gmt
    composition.post_status
    composition.comment_status
    composition.ping_status
    composition.post_password
    composition.post_name
    composition.to_ping
    composition.pinged
    composition.post_modified
    composition.post_modified_gmt
    composition.post_content_filtered
    composition.post_parent
    composition.guid
    composition.menu_order
    composition.post_type
    composition.post_mime_type
    composition.comment_count
    composition.comments
    composition.year
    composition.duration
    composition.instrumentation
    composition.soundcloud_etc
    composition.cd_url
    composition.cd_title
    venue_or_series.ID
    venue_or_series.post_title
    venue_or_series.post_content
    venue_or_series.post_excerpt
    venue_or_series.post_author
    venue_or_series.post_date
    venue_or_series.post_date_gmt
    venue_or_series.post_status
    venue_or_series.comment_status
    venue_or_series.ping_status
    venue_or_series.post_password
    venue_or_series.post_name
    venue_or_series.to_ping
    venue_or_series.pinged
    venue_or_series.post_modified
    venue_or_series.post_modified_gmt
    venue_or_series.post_content_filtered
    venue_or_series.post_parent
    venue_or_series.guid
    venue_or_series.menu_order
    venue_or_series.post_type
    venue_or_series.post_mime_type
    venue_or_series.comment_count
    venue_or_series.comments
    venue_or_series.venue_city
    venue_or_series.venue_country
    venue_or_series.venue_website
    performer.ID
    performer.post_title
    performer.post_content
    performer.post_excerpt
    performer.post_author
    performer.post_date
    performer.post_date_gmt
    performer.post_status
    performer.comment_status
    performer.ping_status
    performer.post_password
    performer.post_name
    performer.to_ping
    performer.pinged
    performer.post_modified
    performer.post_modified_gmt
    performer.post_content_filtered
    performer.post_parent
    performer.guid
    performer.menu_order
    performer.post_type
    performer.post_mime_type
    performer.comment_count
    performer.comments
    performer.performer_url

    Any idea, anyone?

    Thank you very much!

    Stefan

    P.S. Thank you, Jory Hogeveen (@keraweb), for your recent valuable advice. Everything could be solved!

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Stefancom

    (@stefancom)

    I was trying to use Find, like this:

    
    			
    <?php
    
    $performances = pods( 'performances' );
    $params = array(
    
    'orderby' => 'performances.concert_date DESC',
    'limit' => -1,
    'where' => "'performance.composition' = 'works.post_title'"
    );
    
    $performances->find( $params );
    
    while ( $performances->fetch() ) {
    echo $performances->display( 'performances' );
    }
    
    ?>
    

    But can PHP be used in the template at all? It appears not to work.

    Thread Starter Stefancom

    (@stefancom)

    Yeah, I think I will not be able to fix this. Interestingly, I found the following notes by Jim True:

    https://pods.io/forums/topic/how-to-conditionally-display-related-post-data-in-pods-template/

    It is about using the IF tag, and that may be something for me to look into. In that example (not mine) he suggests to work with a separat template (including “where =”), and I have the feeling this could be something that may lead me to a solution. Would someone have a hint which helps me go the right path?

    Thread Starter Stefancom

    (@stefancom)

    Hi,

    So, I need to apologize for the many confusing messages. Turns out, spending those hours was absolutely worth it–and Jim True’s before mentioned advice from 2017 did the trick!

    This is what he had commented to another user:

    If this is a single-select, you can’t use the EACH wrapper, but you also can’t use traversal, so if you’re trying to reach DOWN into a linked record that’s linked to the one you’re currently traversing (ie data that’s linked to the linked faculty profile), you need to do that with a separate template that goes through a faculty profile and outputs what you want and is called from the current post with:

    [pods name="faculty-profiles" where="employee.ID = {@ID}" template="Faculty Profile"]

    And what can I say? I jut got it to work!!!

    Thanks, Jim! I am sorry for this thread, when eventually I was able to figure it out on my own. Thanks for the great only resources (including the Podscast).

    This thread can be marked as resolved.

    Stefan

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Conditional fields’ is closed to new replies.