Skip to content

Commit

Permalink
Merge pull request #77 from Really-Simple-Plugins/fixed-tags
Browse files Browse the repository at this point in the history
fixed tags
  • Loading branch information
rlankhorst authored Sep 5, 2023
2 parents 13b8387 + 6ca7371 commit 6fc628e
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions views/tags.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
<?php
$index = 0;
if ($recipe->keywords || $recipe->preview ) {
?>
<h4 class="zrdn-tags-label zrdn-recipe-label"><?php _e( "Tags", "zip-recipes" ) ?></h4>
?>
<h4 class="zrdn-tags-label zrdn-recipe-label"><?php _e( "Tags", "zip-recipes" ) ?></h4>
<?php
echo '<div class="zrdn-tags-container">';
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 ++
?>
<div class="zrdn-tag-item">
Expand All @@ -28,4 +31,3 @@
}
}
if ($recipe->keywords) echo '</div>';

0 comments on commit 6fc628e

Please sign in to comment.