Hi @airtasker6, as far as I can tell, it looks like you have the right idea with all the dynamic tags in your template. So you seem to be on the right track! The documentation might not mention how to put that specific field in that specific attribute, but luckily the syntax is the same no matter which attribute you want to work with. If you’re putting a tag inside and attribute, just swap <> for {}, exactly as you’ve done. All you need to look up in the docs is which tag/field you should use to display the data you want. You seem to have been successful at that.
Looking at your markup, I’m noticing that your opening a tag has a slash in it, as if it was a closed tag. In other words, you’ve written <a />link text</a> when you probably meant to write <a>link text</a>. If you get rid of that slash, does that fix your issue?
By the way, just for future reference, you might get better support by posting on the L&L forum. It’s a much more active community and there are more people visiting it, so you’re quite likely to get a response from someone experienced with the particular issue you’re facing.
Thread Starter
PSS
(@airtasker6)
Hi Ben,
Thanks for your reply. I will keep in mind the L&L forum next time.
That example was one of many I tried, including without the trailing slash like so:
<If user_field=name is value="{Field author_name}">
<a href="{Field acf_text=edit_post_link}">Edit post</a>
<Else />You are not the author.
</If>
I have also tried “custom_field” instead of “acf_text”. None of them link to the URL in the “edit_post_link” ACF field. The words “Edit Post” on the post links back to the post itself every time.
The “Else” statement works to display the alternate text but “Edit Post” isn’t linking to the correct URL.
A couple more ideas to try:
- The docs mention that ACF text fields “can be displayed simply with the
Field tag.” Have you tried writing the attribute as href="{Field edit_post_link}" instead of href="{Field acf_text=edit_post_link}" ?
- If you just write
<Field edit_post_link /> in your template my itself, does that display the contents of your ACF field? If not, are you sure you’re using the right field name?
- If neither of those work, I just noticed when I look at the list of fields available inside a post loop (which is also all the fields that are available when you’re on a post, even a custom post) there’s a
edit_url field. Does it work if you use href="{Field edit_url}" instead?
Thread Starter
PSS
(@airtasker6)
Hi @bentangible,
Thanks for your reply. Using
href="{Field edit_post_link}"
has worked which is great … ‘coz much simpler. 🙂
I have a custom edit URL which is why I needed to use the URL in the custom field field instead of “edit_url”. Thanks muchly for your assistance with troubleshooting and for this amazing plugin. *thumbs up*