• Resolved jaceejoef

    (@jaceejoef)


    Hi,

    I have the following CPT and ACT:

    CPT: Services
    Fields: name, description, amenities

    CPT: Location
    Fields: name, address, email, phone, service location (repeater)

    ACT: Service Location
    Fields: service (relationship to Services CPT), work hours

    When I go to Service single page, I want to display all the locations for that service.

    You’ve mentioned in the FAQ about pandarf_pods_field_attrs and pandarf_data_attrs to filter the pods_field but I don’t get how to use it.

Viewing 1 replies (of 1 total)
  • Plugin Author Coding Panda

    (@codingpanda)

    Hi @jaceejoef

    Sorry for the delay.

    From your description, you can use the following code on a single Service page to display all the locations for that service.

    $service_locations = pods( 'service_location' );
    
    $params = array(
        'where' => 'service.id = ' . get_the_ID()
    );
    
    $locations = $service_locations->find( $params );
    
    if ( 0 < $locations->total() ) {
            while ( $locations->fetch() ) {
    
             echo $locations->display( 'name' ) . '<br/>';        
    
            } 
        } 
    

    Alternatively, you can merge Location CPT and Service Location ACT as Service Location ACT, and use it as the repeater field “location” in the Services CPT, then on the single Service page, use pods_field(‘location’) to fetch the locations.

    Hope it makes sense.

    Best Regards

Viewing 1 replies (of 1 total)
  • The topic ‘Filter by repeater fields value’ is closed to new replies.