Fabian Möbis
Fabian Möbis

Reputation: 1

PODS: limit result of relationsship field

I have 2 Pods "Tools" with Field name and test and "Test" with Field date and tool. In the tool content type is test a relationsip field for field tool in Test.

When we want to get some relation field we do

$pod = pods( 'pod_name', get_the_id() );
$related = $pod->field( 'relationship_field' );

and I get list of results array 1, 2, 3 ... but I need only 2 results. How can I do that?

Upvotes: 0

Views: 369

Answers (1)

Scott Kingsley Clark
Scott Kingsley Clark

Reputation: 987

Try array_splice

$related = array_splice( $related, 0, 2 );

Upvotes: 1

Related Questions