CPT Rleationship category name
-
Hello how are you?
I have two CPTs, one called Ligas (leagues) and the other Clubes (clubs), both related to ACF (relacion_ligas_clubes). When I show a club, it should show which leagues it belongs to. I was able to do some of that with the following code in the single.php file, but what it outputs is the league id:
<?php if (in_category('clubes')) { ?> <p><strong>Liga:</strong> <?php the_field('relacion_ligas_clubes'); ?></p> <?php } ?>
I would need to show the name of the league and that in turn be a link that takes me to it.
I also tried this code, but it shows me the “clubes” category:
<li><strong>Liga:</strong> <?php $name = get_post( ($id) )->post_type; echo $name; ?> </li>
CPT Ligas:
https://contextodigital.com.ar/futbolinterior/ligas/
CPT Clubes:
https://contextodigital.com.ar/futbolinterior/clubes/
Club:
https://contextodigital.com.ar/futbolinterior/clubes/club-atletico-acassuso/
If someone could help me, I will appreciate it.
The page I need help with: [log in to see the link]
- The topic ‘CPT Rleationship category name’ is closed to new replies.