This worked for me in testing, but if I had another required field that wasn’t filled out, the website field would look like it saved when it didn’t, resulting in an empty template as described.
Do you by chance have another required field that’s being left empty?
In the website field Edit options, is “Output as a link” unchecked?
There also should not be spaces around the equals sign between href and “{@website_link}"
Thanks for the tips, but it doesn’t seem to have resolved it. All of the fields in my custom post type are optional, so there’s no required fields left empty. I’d assume it’d be impossible to save/publish a post with incomplete required fields anyways though?
The field is also set to “output as a link” and “open in a new window.”
And whilst there were spaces in my href code, I removed them in the template, but that didn’t fix it either.
The exact same syntax is used in the same template for a relationship link, and it works fine too. I’m left staring at the code confused haha.
-
This reply was modified 4 years ago by
mungbean.
Marking as resolved! I’ve figured it out.
So having the Website field with the “output as a link” checked, and then wrapping that Pod reference in an href in the template confuses Pods, or something like that. I unchecked the “output as a link” option and the href works now.
I suppose my other hrefs in the template worked because the referenced Pod field were relationship/.guid Pod references, which I don’t think have a “output as a link” option.
It might be helpful to include some contextual helper text on the Pod or the template about the “output as a link” option.
Thanks for letting us know @mungbean !