I am building a child theme for my personal use. Not very familiar with php, can only do basic things based on logic. I need to exclude one tag from being displayed on the tag list on a single post. Preferably so nothing is displayed at all when this tag is the only tag assigned to the post (I mean, no "Tags" title, nothing).
Here is what I have from the parent theme:
$tags = get_the_tags( $post->ID );
$separator = ' ';
$output = '';
if($tags){
echo '<div class="entry-tags">';
echo "<p><span>" . __('Tags', 'tracks') . "</span>";
foreach($tags as $tag) {
$output .= '<a href="'.get_tag_link( $tag->term_id ).'" title="' . esc_attr( sprintf( __( "View all posts tagged %s", 'tracks' ), $tag->name ) ) . '">'.$tag->name.'</a>'.$separator;
}
echo trim($output, $separator);
echo "</p>";
echo "</div>";
}
I tried applying this solution, but it didn't work. Probably because I don't fully understand what I'm doing. :)
Could someone maybe help me with this.