So... I'm making a list of players on a hockey team here. And I have a bunch of extra metadata included in it, like goals, assist, points, etc etc. And all good so far, I got the table set up and it's working just as I want it. however. Now I get to the point as to link to a player site (each player is their own custom-post-type).
Take a look at the code below:
<!-- GET PLAYERS AND SORT BY # TO START WITH! -->
<table class="spillere_tb">
<tr class="headrow"><th colspan="8">SPILLERE</th></tr>
<tr class="inforow">
<th class="sp_num active">#</th>
<th class="sp_navn">Navn</th>
<th class="sp_stat">GP</th>
<th class="sp_stat">PIM</th>
<th class="sp_stat">G</th>
<th class="sp_stat">A</th>
<th class="sp_stat">P</th>
<th class="sp_bayer"> </th>
</tr>
<?php
$i = 0;
$args = array(
'post_type' => 'spillere',
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'posisjon',
'field' => 'slug',
'terms' => array( 'loper', 'back' ),
),
),
'meta_key' => 'nummer',
'orderby' => 'meta_value_num',
'order' => 'ASC',
'meta_query' => array(
array(
'key' => 'nummer',
'compare' => 'LIKE',
)
)
);
// The Query
query_posts( $args ); ?>
<?php // The Loop
while ( have_posts() ) : the_post();
if ($i % 2 == 0) {
$row = 'odd';
} else {
$row = 'even';
};
$post_id = get_the_ID();
$nummer = get_post_meta ( $post_id, 'nummer', true);
$fnavn = get_post_meta ( $post_id, 'fornavn', true);
$enavn = get_post_meta ( $post_id, 'etternavn', true);
$gp = get_post_meta ( $post_id, 'gp', true);
$pim = get_post_meta ( $post_id, 'pim', true);
$maal = get_post_meta ( $post_id, 'maal', true);
$assist = get_post_meta ( $post_id, 'assist', true);
$poeng = get_post_meta ( $post_id, 'poeng', true);
$ba = get_post_meta ( $post_id, 'bayer', true);
echo '<tr class="'.$row.'">';
echo '<td class="active">#'.$nummer.'</td>'; // nummer
echo '<td class="sp_navn"><a href="#">'.$fnavn.' '.$enavn.'</a></td>'; // navn
echo '<td>'.$gp.'</td>'; // games played
echo '<td>'.$pim.'</td>'; // penalty in minutes
echo '<td>'.$maal.'</td>'; // mål
echo '<td>'.$assist.'</td>'; // assist
echo '<td>'.$poeng.'</td>'; // poeng
echo '<td class="sp_bayer">'.$ba.'</td>'; // bayere
echo '</tr>';
$i++;
endwhile;
// Reset Query
wp_reset_query(); ?>
</table>
Now, this gets all the metadata perfectly, and sorts by the custom metadata jersey number, works just fine, BUT! How in the world do I get the permalink into the players name where you can see the ?? Whenever I add something there it just adds the link in a line above the table, and not even inside the table at all!