Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    get_post( ($id) )->post_type will return your CPT’s name, not the name of that specific post. If it’s returning “clubes”, that’s your CPT, not the related club name. I’m not sure how you save a club’s name in your CPT, perhaps post_title?

    In any case, $id is related to a club, not a league. I don’t know what your data scheme is like. Perhaps you need to get another ACF field for the $id club post that tells us what league it’s associated with? I assume that will be another CPT ID, this time of type ligas. Then you get that post and echo out its post_title property (if that’s how you save league names).

    Note that you cannot use the_field('field-name-here') to get a field for the $id club post. You need an equivalent function that accepts a post ID arg regardless of what the current post is in the loop. If you’re not sure how that is done, consult ACF documentation.

    Thread Starter Leonardo

    (@lbc75)

    Thanks! That helped me a lot!!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘CPT Rleationship category name’ is closed to new replies.