0

I have a metabox which shows custom post type named football_player as dropdown.Now I want retrieve the permalink of this custom post in another custom post named football_team template.
Everything; name, image, squad number, is working fine for me except permalink. Following is the code:

$home_starting_player_names = rwmb_meta( 'pb_select_players', array( 'multiple' => true ) ); ?>

          <?php 
           foreach ( $home_starting_player_names as $home_starting_player ){?>
            <li class ="clearfix" style="width: 100%; margin-top: 10px;">
            <aside class="starting-player-image clearfix" style="width: 100px; height: 100px;"><?php  echo get_the_post_thumbnail($home_starting_player); ?></aside>
            <aside class="starting-player-name" style="width: 100px; height: 100px; margin-left: 50px; margin-top: 20px;"><?php  echo get_the_title($home_starting_player); ?></aside>
           <aside class="starting-player-number" style="width: 100px; height: 100px;"><?php  echo get_post_meta( $home_starting_player, 'pb_squad_number', true );?></aside>
           <aside class="team-match-centre-details">
        <div class="team-match-details" data-toggle="tooltip" data-placement="top" title="Click for details">
            <a href="<?php echo get_permalink( 'football_player' ); ?>"><i class="fa fa-arrow-right" aria-hidden="true"></i></a>
        </div>
      </aside>

1 Answer 1

0

I have solved it by myself: I used following codes instead of

<a href="<?php echo get_permalink( 'football_player' ); ?>"><i class="fa fa-arrow-right" aria-hidden="true"></i></a>

I used this code:

<a href="<?php echo get_permalink( $home_starting_player ); ?>"><i class="fa fa-arrow-right" aria-hidden="true"></i></a>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.