Using Custom Fields in Joomla, I created several custom fields for my article layout. The data that will populate the custom fields will include 1) vendor name, and 2) a URL path to the vendor's website.
The php code that loads that data is:
(For the vendor name)
<?php echo $this->item->jcfields[7]->value; ?>
(For the vendor's website URL)
<?php echo $this->item->jcfields[19]->value; ?>
The result should be: Vendor
My current code (for testing) is:
<?php echo $buyURL; ?><br>
<a href='"<?php echo $buyURL; ?>"'> <?php echo $vendorName; ?></a>
I confirmed the $buyURL variable works correctly and displays the correct URL value when echo'd by itself.
When it's used inside <a href=""></a>
statements, the resulting embedded URL link points to: https://my-website.com/demo/category/"<"a href="https://vendor-website.com/tdmSmO" rel="nofollow noopener noreferrer" target="_blank">https://vendor-website.com/tdmSmO</a>"
It appears Joomla's url.php from /plugins/fields/urls/tmpl has a major role in the wrong URL target.
How do I resolve this problem with the wrong URL target for custom URL fields?