Last active
May 23, 2022 00:16
-
-
Save Shelob9/6679914 to your computer and use it in GitHub Desktop.
Get related posts from a Pods custom relationship field and show post title--as a link--and a custom field. For full explanation see: http://pods.io/tutorials/get-values-from-a-custom-relationship-field/
field( 'ttulos_en_los_que_imparte_clase' );
//loop through related field, creating links to their own pages
//only if there is anything to loop through
if ( ! empty( $related ) ) {
foreach ( $related as $rel ) {
//get id for related post and put in ID
//for advanced content types use $id = $rel[ 'id' ];
$id = $rel[ 'ID' ];
//show the related post name as link
echo ''.get_the_title( $id ).'';
//get the value for some_field in related post and echo it
$someField = get_post_meta( $id, 'ttulos_en_los_que_imparte_clase', true );
echo $someField;
} //end of foreach
} //endif ! empty ( $related )
?>
This code is showing critical error for me with Oxygen Builder
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It works for me too! Thanks!