From 6ca7371cd871b0de3ab378819439eac1fde65a05 Mon Sep 17 00:00:00 2001 From: Mark Date: Mon, 4 Sep 2023 14:20:30 +0200 Subject: [PATCH] fixed tags --- views/tags.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/views/tags.php b/views/tags.php index fd3c404..37da5dc 100644 --- a/views/tags.php +++ b/views/tags.php @@ -1,17 +1,20 @@ keywords || $recipe->preview ) { - ?> -

+ ?> +

'; - if (is_array($recipe->keywords) ) { + if ( is_array($recipe->keywords ) ) { foreach ( $recipe->keywords as $tag ) { - if (is_tag($tag)) { - $tag_link = get_tag_link( $tag ); - } else { - $tag_link = "#"; - } + // Check if the tag exists + $existing_tag = term_exists( $tag->name, 'post_tag' ); + if ( $existing_tag ) { + // Get the tag link using the tag ID + $tag_link = get_tag_link( $existing_tag['term_id'] ); + } else { + $tag_link = "#"; + } $index ++ ?>
@@ -28,4 +31,3 @@ } } if ($recipe->keywords) echo '
'; -