I created a taxonomy called animal
and a term meta field called horse
.
I created a function in my functios.php file to make it easier to display the data.
Here is my code:
function regular_info_page() {
$terms = get_the_terms($post->ID, 'animal');
$result = "";
if (is_array($terms) || is_object($terms)){
foreach ($terms as $term) {
$term_id = $term->term_id;
$result .= get_term_meta( $term_id,
'horse', true );
}
}
return $result;
}
The meta field horse
holds a link, and I would like to display the link on my page, but instead of it opening the link, it just reloads the current page.
Here is the code I placed on the page:
<p><a href="https://wordpress.stackexchange.com/questions/312845/<?php regular_info_page(); ?>">For more info on this Bracha, click here.</a></p>
Any ideas?