Welcome to this community Prezido. the_field()
function has echo in it. There is no problem with in_category()
function. You need to use get_field()
function when you echo the values of fields.
I’ve updated your code. This version should work as expected.
<?php
$post = $wp_query->post;
if ( in_category( '5' ) ) {
echo '<table>
<tr><td> ' . get_field( 'song_title' ) . '</td></tr>
<tr><td><b>Artist: </b> ' . get_field( 'artist' ) . '</td></tr>
<tr><td><b >Song Title:</b> ' . get_field( 'song_title' ) . '</td></tr>
<tr><td><b>Song Lenght:</b> ' . get_field( 'song_lenght' ) . '</td></tr>
</table>
'; }