Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Shelob9
Last active May 23, 2022 00:16
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Shelob9/6679914 to your computer and use it in GitHub Desktop.
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/
@nikhilbudhwani
Copy link

this code is not working for me

@Shelob9
Copy link
Author

Shelob9 commented Jul 7, 2020

Sorry this is not working. I have not worked with Pods in awhile and can not help resolve this. Please see this page for Pods support options.

https://pods.io/support/

@aljaber
Copy link

aljaber commented Feb 9, 2021

It works for me, tried using a snippet in elementor.
You need to change 'pod_name' and 'relationship_field' with the real entity and field name, the rest is okay.
Thanks @Shelob9

@gdnwebmedia
Copy link

It works for me, tried using a snippet in elementor.
You need to change 'pod_name' and 'relationship_field' with the real entity and field name, the rest is okay.
Thanks @Shelob9

It works for me too! Thanks!

@ahforayeji
Copy link

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